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

# Complete step

> Complete a step in an instance of a workflow. The step needs to be active and the user
        that the API-Key is associated with needs to have access to the step (they need to act as assigned step owner, workflow lead, or an administrator).



## OpenAPI

````yaml /reference/openapi.json post /instances/{id}/complete_step/
openapi: 3.0.1
info:
  title: Next Matter API
  description: >-
    # Introduction

    This is reference documentation for the Next Matter API. It is a RESTful API
    that can be interacted with by sending JSON-formatted requests. Responses
    are also returned in a JSON format.

            The API doesn't expose any endpoints of the workflow editor.
            This means you can't use this API to edit the underlying workflow structure or change definitions.
     # Testing a request

            Use a third party client, such as curl, Postman, or Advanced REST Client, to test our REST API.
  termsOfService: https://www.nextmatter.com/terms-of-service
  contact:
    email: development@nextmatter.com
  version: v1
  x-logo:
    url: >-
      https://assets-global.website-files.com/5fcecdf27451306b2081fedc/5ff43812707834743db939be_NextMatter_Logo_Horizontal.svg
    backgroundColor: '#FFFFFF'
    altText: Next Matter logo
servers:
  - url: https://core.nextmatter.com/api
security:
  - Bearer: []
paths:
  /instances/{id}/complete_step/:
    post:
      tags:
        - Instance
      summary: Complete step
      description: >-
        Complete a step in an instance of a workflow. The step needs to be
        active and the user
                that the API-Key is associated with needs to have access to the step (they need to act as assigned step owner, workflow lead, or an administrator).
      operationId: instances_complete_step
      parameters:
        - name: id
          in: path
          description: A unique integer value identifying this workflow instance.
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompleteStep'
        required: true
      responses:
        '200':
          description: Returns the updated instance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Public_Instance'
components:
  schemas:
    CompleteStep:
      required:
        - step_id
      type: object
      properties:
        step_id:
          title: Step id
          type: integer
          description: You can find the form field ID in the workflow editor.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/CompleteAction'
        mode:
          title: Mode
          type: string
          description: >-
            Modes available to complete the step. If not specified, the default
            is "complete".


            - `complete` — complete the step

            - `save` — save data in the step
          default: complete
          enum:
            - save
            - complete
    Public_Instance:
      required:
        - process
      type: object
      properties:
        name:
          title: Name
          maxLength: 255
          type: string
          description: >-
            The name of the instance. If automatic naming has been enabled, the
            name parameter needs to be an empty string, null, or completely left
            out.
          nullable: true
          default: ''
        process:
          title: Process
          type: string
          description: >-
            The related workflow resource URI. For example
            https://core.nextmatter.com/api/processes/[IDoftheworkflowinNM]/.
                    To find the workflow ID, navigate to the respective workflow at app.nextmatter.com, and copy the number at the very end of the URL.
          format: uri
        deadline:
          title: Deadline
          type: string
          description: Time by which the instance should be completed
          format: date-time
          nullable: true
        priority:
          title: Priority
          type: string
          description: >-
            The priority of the instance. If you don't send this parameter, the
            priority will be "Regular". Other options are V - "Very High" and H
            - "High".
          nullable: true
          enum:
            - V
            - H
        tags:
          title: Tags
          type: array
          description: A list of string tags separated by a comma
          items:
            type: string
        step_assignments:
          type: array
          description: >-
            A list of user assignments per step. This is only required for
            workflows that have at least one step assignee set to
                    "Select user at workflow start".
          items:
            $ref: '#/components/schemas/StepAssignment'
        url:
          title: Url
          type: string
          description: >-
            The instance resource URI. For example
            https://core.nextmatter.com/api/instances/[instance_id]/.
          format: uri
          readOnly: true
        id:
          title: ID
          type: integer
          readOnly: true
        started_time:
          title: Started time
          type: string
          format: date-time
          readOnly: true
        completed_time:
          title: Completed time
          type: string
          format: date-time
          nullable: true
          readOnly: true
        aborted_time:
          title: Aborted time
          type: string
          format: date-time
          nullable: true
          readOnly: true
        last_updated_time:
          title: Last updated time
          type: string
          format: date-time
          readOnly: true
        process_snapshot:
          title: Process snapshot
          type: string
          description: |-
            A snapshot of the workflow structure.
                    If you set "inject_values" query parameter to "true", this will return the input values of the form fields.,
                    If you set "steps_time_frame" query parameter to "true", this will return the completion values of the form fields.
          readOnly: true
        active_step_ids:
          type: array
          description: List of active step IDs of the instance
          readOnly: true
          items:
            type: integer
        step_deadlines:
          title: Step deadlines
          type: string
          description: List of instance step deadlines
          readOnly: true
        public_url:
          title: Public URL
          minLength: 1
          type: string
          description: >-
            The public URL of the instance (for status tracking), if enabled in
            the workflow settings
          readOnly: true
        stage:
          title: Stage
          minLength: 1
          type: string
          readOnly: true
    CompleteAction:
      required:
        - action_id
        - input_object
      type: object
      properties:
        action_id:
          title: Action id
          type: integer
          description: You can find the form field ID in the workflow editor.
        input_object:
          title: Input object
          type: object
          properties: {}
          description: >-
            Each form field type requires a different JSON object:


            - Address: {"city":"city", "street": "street", "zipCode": "zipCode"}

            - Checklist: {"itemsChecked": ["Option A", "Option B"]}

            - Date: {"date": "2021-06-16T10:00:00Z"}

            - Email: {"emailValue": "jdoe@email.com"}

            - File upload: {"files": ["https://fileurl.com/examplefile.pdf"]}

            - Image upload: {"images": ["https://fileurl.com/exampleimage.jpg"]}

            - Drawing: {"url": ["https://fileurl.com/exampleimage.jpg"]}

            - Number: {"numberValue": 10000, "formattedValue": ""}

            - Single-select dropdown: {"itemSelected": "Option A"}

            - Multi-select dropdown: {"itemsSelected": ["Option A", "Option C"]}

            - Table: {"jsonResult": "[[\"Header1\",
            \"Header2\"],[\"Value1\",\"Value2\"]]"} 

            - Instruction: {"inputValue": ""}

            - Radio: {"radioItemSelected": "Option A"}

            - Text: {"inputValue": "Example"}

            - URL: {"url": "http://nextmatter.com"}

            - User selection: {"selection": {"user_email":
            "john.doe@email.com"}}

            - Routing: {"action": "skip_forward", "comment":"", "label":"",
            "returnToStep":"Step_ID"}


            For more examples, see [Help center
            article](https://help.nextmatter.com/docs/complete-a-step#routing).
    StepAssignment:
      required:
        - step_id
        - user_id
      type: object
      properties:
        step_id:
          title: Step id
          type: integer
          description: >-
            The assigned step's ID. You can find the step id in the workflow
            editor
                by accessing the step and inspecting the URL
        user_id:
          title: User id
          type: integer
          description: >-
            The ID of the user assigned as the step's lead. If you dont know the
            user ID, get in touch with our Next Matter support team
      description: >-
        A list of user assignments per step. This is only required for workflows
        that have at least one step assignee set to
                "Select user at workflow start". 
  securitySchemes:
    Bearer:
      type: apiKey
      description: >

        Authentication is API key based. As an admin, you can generate an API
        key in Next Matter by going to Company > Next Matter API keys.


        When sending requests to the API, authenticate by passing the API key in
        the "Authorization"

        HTTP header, prepended with the string "Api-Key ".


        For example:

         Authorization: Api-Key xyzabc.12fsfe242ubdgakew
      name: Authorization
      in: header
      x-default: Api-Key YOUR_NM_API_KEY

````