> ## Documentation Index
> Fetch the complete documentation index at: https://developer.eka.care/llms.txt
> Use this file to discover all available pages before exploring further.

# Complete a form

> COMPLETED with the response, or AWAITING_SIGNATURE when `awaiting_signature` is set (a consent still to be signed).



## OpenAPI

````yaml api-reference/doc-tool/ipd-api/protocol-openapi.json post /protocol/workflow/forms/{id}/complete
openapi: 3.1.0
info:
  title: Eka Protocol API
  version: '1.0'
  description: >-
    Hospital workflows for IPD: rules, the tasks they create, and the forms
    filled on an admission.
servers:
  - description: Production
    url: https://api.eka.care
  - description: Stage/Sandbox
    url: https://api.dev.eka.care
security: []
tags:
  - name: Tasks
    description: >-
      Workflow tasks at a hospital. Rules create them; users claim, release,
      complete and cancel them here. Task documents are also readable live from
      Firestore (`protocol/{bid}/tasks`) through `@orbi/protocol-sdk`; every
      change goes through this API.
  - name: Forms
    description: >-
      Forms filled on an entity (today: an admission, the IPD Forms tab) and
      what happened to each.
  - name: Rules
    description: >-
      Hospital workflow rules: events → conditions → tasks. Each save is a new
      version, compiled to a workflow.
  - name: Catalog
    description: The events and fields rules are written against.
  - name: Events
    description: 'Fire an event for a scope: every active rule on it starts a run.'
  - name: SA forms
    description: >-
      The hospital's SA forms (its own and the system ones), with versions and
      archiving.
  - name: SA form drafts
    description: SA forms saved before they are ready. Not offered in IPD until published.
  - name: AI drafts
    description: Draft an SA form from a prompt or a file with AI.
paths:
  /protocol/workflow/forms/{id}/complete:
    post:
      tags:
        - Forms
      summary: Complete a form
      description: >-
        COMPLETED with the response, or AWAITING_SIGNATURE when
        `awaiting_signature` is set (a consent still to be signed).
      operationId: postFormsIdComplete
      parameters:
        - name: auth
          in: header
          required: true
          description: >-
            The access token. The gateway verifies it and passes the user and
            the business on.
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: string
            pattern: ^fr_[a-z0-9]+_[a-f0-9]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                response_id:
                  type: string
                  minLength: 1
                  maxLength: 200
                response_url:
                  type: string
                  format: uri
                  maxLength: 2000
                awaiting_signature:
                  type: boolean
                signer:
                  anyOf:
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: patient
                      required:
                        - kind
                      additionalProperties: false
                    - type: object
                      properties:
                        kind:
                          type: string
                          const: attendee
                        name:
                          type: string
                          minLength: 1
                          maxLength: 200
                        mobile:
                          type: string
                          minLength: 8
                          maxLength: 20
                        relation:
                          type: string
                          maxLength: 100
                      required:
                        - kind
                        - name
                        - mobile
                      additionalProperties: false
              required:
                - response_id
              additionalProperties: false
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    $ref: '#/components/schemas/FormDoc'
                required:
                  - status
                  - data
        '401':
          description: No signed-in user, or no business on the session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Not in a state for this.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request failed validation; `details` names each invalid path.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    FormDoc:
      type: object
      properties:
        id:
          type: string
        bid:
          type: string
        entity_type:
          type: string
          enum:
            - ADMISSION
            - APPOINTMENT
            - PRESCRIPTION
            - PATIENT
        entity_id:
          type: string
        patient_id:
          type: string
        kind:
          type: string
          enum:
            - SA
            - CONSENT
            - MCERT
        form_id:
          type: string
        form_name:
          type: string
        status:
          type: string
          enum:
            - IN_PROGRESS
            - AWAITING_SIGNATURE
            - COMPLETED
            - MISSED
            - CANCELLED
            - DECLINED
        response_id:
          anyOf:
            - type: string
            - type: 'null'
        response_url:
          anyOf:
            - type: string
            - type: 'null'
        created_by:
          $ref: '#/components/schemas/Actor'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_by:
          anyOf:
            - $ref: '#/components/schemas/Actor'
            - type: 'null'
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
        signer:
          anyOf:
            - anyOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      const: patient
                  required:
                    - kind
                - type: object
                  properties:
                    kind:
                      type: string
                      const: attendee
                    name:
                      type: string
                    mobile:
                      type: string
                    relation:
                      type: string
                  required:
                    - kind
                    - name
                    - mobile
            - type: 'null'
        closed_note:
          anyOf:
            - type: string
            - type: 'null'
        closed_by:
          anyOf:
            - $ref: '#/components/schemas/Actor'
            - type: 'null'
        closed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
      required:
        - id
        - bid
        - entity_type
        - entity_id
        - patient_id
        - kind
        - form_id
        - form_name
        - status
        - response_id
        - response_url
        - created_by
        - created_at
        - updated_at
        - completed_by
        - completed_at
        - signer
        - closed_note
        - closed_by
        - closed_at
    Error:
      type: object
      properties:
        status:
          type: string
          const: error
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: string
                  message:
                    type: string
                required:
                  - path
                  - message
          required:
            - code
            - message
      required:
        - status
        - error
    Actor:
      type: object
      properties:
        oid:
          type: string
        name:
          type: string
        ps:
          type: string
          enum:
            - D
            - S
            - AD
            - SYSTEM
        s:
          type: string
      required:
        - oid
        - name
        - ps
        - s

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.