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

# Update Document Route

> Modifies the route of an in-flight document (status ON_APPROVAL or ON_SIGN).
Steps that have already acted are preserved; pending future steps are
replaced with the provided ones.

Required scope: documents:write

Error Codes:
  - DEVELOPER.SCOPE_INSUFFICIENT: The key lacks the documents:write scope.
  - DOCUMENT_NOT_FOUND: No document with that id is accessible to the key.
  - INVALID_ARGUMENT: The document is not in flight, or a step is malformed.



## OpenAPI

````yaml /api-reference/openapi.yaml post /developer/v1/documents/{document_id}/route/_modify
openapi: 3.0.3
info:
  description: >-
    Публичный Developer API Doodocs People. Аутентификация — заголовок
    X-API-Key.
  title: Doodocs People API
  version: 1.0.0
servers:
  - description: Production
    url: https://app.doodocs.kz/api
security:
  - ApiKeyAuth: []
tags:
  - description: ApiKeyService exposes Developer API key utilities.
    name: ApiKeyService
  - description: >-
      DocumentService is the public Developer API for documents: reading,
      creating,
       downloading, routing, and signing.

       Authentication: X-API-Key. Every call runs as the key's owner within the key's
       tenant — the owner's document permissions decide what is visible and which
       actions are allowed, exactly as they would in the web app. Fields that carry
       personal data of other participants (names, IIN, positions) are never exposed;
       participants are identified by id only.

       Typical flow: discover a template with ListDocumentTemplates /
       GetDocumentTemplate (to learn its variable_schema), create a draft with
       CreateDocument, set its route with SetDocumentRoute, launch it with
       SendDocument, then apply signatures with SignDocument as slots become active.

       To circulate a document produced elsewhere, upload it with FileService and
       pass the confirmed file_id to CreateDocument instead of a template.
    name: DocumentService
  - description: |-
      EmployeeService is the public Developer API for reading employees.

       Authentication: X-API-Key. The key's tenant and the key owner's data scope
       determine which employees and fields are visible; sensitive fields the caller
       may not view are omitted and listed in `redacted_fields`.
    name: EmployeeService
  - description: |-
      FileService uploads the files documents are created from.

       Authentication: X-API-Key. An upload belongs to the key's owner, and only
       their key can attach it to a document.

       Flow: CreateFileUpload reserves the file and returns a presigned POST form,
       the client sends the bytes straight to storage, ConfirmFileUpload marks the
       upload complete, and CreateDocument attaches it by id.
    name: FileService
  - description: IngestService accepts batches of external records into the tenant.
    name: IngestService
  - name: LoginService
  - description: |-
      WebhookService lets a tenant manage subscriptions to Developer API events.

       Authentication: X-API-Key with the webhooks:manage scope.
    name: WebhookService
paths:
  /developer/v1/documents/{document_id}/route/_modify:
    post:
      tags:
        - DocumentService
      summary: Update Document Route
      description: >-
        Modifies the route of an in-flight document (status ON_APPROVAL or
        ON_SIGN).

        Steps that have already acted are preserved; pending future steps are

        replaced with the provided ones.


        Required scope: documents:write


        Error Codes:
          - DEVELOPER.SCOPE_INSUFFICIENT: The key lacks the documents:write scope.
          - DOCUMENT_NOT_FOUND: No document with that id is accessible to the key.
          - INVALID_ARGUMENT: The document is not in flight, or a step is malformed.
      operationId: DocumentService_UpdateDocumentRoute
      parameters:
        - description: Document id (UUID).
          in: path
          name: document_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDocumentRouteRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateDocumentRouteResponse'
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Status'
          description: Default error response
components:
  schemas:
    UpdateDocumentRouteRequest:
      properties:
        document_id:
          description: Document id (UUID).
          type: string
        steps:
          description: >-
            The replacement for the pending part of the route; steps that
            already
             acted are preserved.
          items:
            $ref: '#/components/schemas/RouteStepInput'
          type: array
      required:
        - document_id
        - steps
      type: object
    UpdateDocumentRouteResponse:
      properties:
        document:
          allOf:
            - $ref: '#/components/schemas/Document'
          description: The document with its modified route.
          readOnly: true
      type: object
    Status:
      description: >-
        The `Status` type defines a logical error model that is suitable for
        different programming environments, including REST APIs and RPC APIs. It
        is used by [gRPC](https://github.com/grpc). Each `Status` message
        contains three pieces of data: error code, error message, and error
        details. You can find out more about this error model and how to work
        with it in the [API Design
        Guide](https://cloud.google.com/apis/design/errors).
      properties:
        code:
          description: >-
            The status code, which should be an enum value of
            [google.rpc.Code][google.rpc.Code].
          format: int32
          type: integer
        details:
          description: >-
            A list of messages that carry the error details.  There is a common
            set of message types for APIs to use.
          items:
            $ref: '#/components/schemas/GoogleProtobufAny'
          type: array
        message:
          description: >-
            A developer-facing error message, which should be in English. Any
            user-facing error message should be localized and sent in the
            [google.rpc.Status.details][google.rpc.Status.details] field, or
            localized by the client.
          type: string
      type: object
    RouteStepInput:
      description: RouteStepInput is one step of a route to set or update.
      properties:
        employee_ids:
          description: Employees to place on the step, one participant slot each.
          items:
            type: string
          type: array
        rule:
          description: >-
            STEP_RULE_ALL — every participant must act; STEP_RULE_ANY_ONE — the
            first
             participant to act completes the step.
          enum:
            - STEP_RULE_UNSPECIFIED
            - STEP_RULE_ALL
            - STEP_RULE_ANY_ONE
          format: enum
          type: string
        step_type:
          description: >-
            What the step's participants do: STEP_TYPE_APPROVAL or
            STEP_TYPE_SIGNING.
          enum:
            - STEP_TYPE_UNSPECIFIED
            - STEP_TYPE_APPROVAL
            - STEP_TYPE_SIGNING
          format: enum
          type: string
      required:
        - step_type
        - rule
        - employee_ids
      type: object
    Document:
      description: >-
        Document is the public view of a document. Personal data of participants
        is
         never included — participants are referenced by id only.
      properties:
        completed_at:
          description: When the document reached COMPLETED; unset otherwise.
          format: date-time
          readOnly: true
          type: string
        create_time:
          description: When the document was created.
          format: date-time
          readOnly: true
          type: string
        date:
          description: Document date, YYYY-MM-DD.
          readOnly: true
          type: string
        department_id:
          description: Department the document is attributed to; may be empty.
          readOnly: true
          type: string
        files:
          description: >-
            The document's stored files; pick one by file_type in
            DownloadDocument.
          items:
            $ref: '#/components/schemas/DocumentFileRef'
          readOnly: true
          type: array
        id:
          description: Document id (UUID).
          readOnly: true
          type: string
        initiator_employee_id:
          description: The employee who created the document.
          readOnly: true
          type: string
        number:
          description: Registration number; empty until assigned.
          readOnly: true
          type: string
        organization_id:
          description: Legal entity the document belongs to.
          readOnly: true
          type: string
        route:
          allOf:
            - $ref: '#/components/schemas/DocumentRoute'
          description: The active route of the document, if any.
          readOnly: true
        status:
          description: Circulation state.
          enum:
            - DOCUMENT_STATUS_UNSPECIFIED
            - DOCUMENT_STATUS_DRAFT
            - DOCUMENT_STATUS_ON_APPROVAL
            - DOCUMENT_STATUS_ON_SIGN
            - DOCUMENT_STATUS_COMPLETED
            - DOCUMENT_STATUS_REJECTED
            - DOCUMENT_STATUS_ARCHIVED
            - DOCUMENT_STATUS_CHANGE_REQUESTED
            - DOCUMENT_STATUS_REVOKED
          format: enum
          readOnly: true
          type: string
        subject_employee_ids:
          description: The employees the document is about (its subjects).
          items:
            type: string
          readOnly: true
          type: array
        title:
          description: Document title as shown in the registry.
          readOnly: true
          type: string
        type_id:
          description: Document type id (nil for ad-hoc documents).
          readOnly: true
          type: string
        update_time:
          description: When the document last changed.
          format: date-time
          readOnly: true
          type: string
      type: object
    GoogleProtobufAny:
      additionalProperties: true
      description: >-
        Contains an arbitrary serialized message along with a @type that
        describes the type of the serialized message.
      properties:
        '@type':
          description: The type of the serialized message.
          type: string
      type: object
    DocumentFileRef:
      properties:
        file_id:
          description: Id of the stored file.
          readOnly: true
          type: string
        file_type:
          description: >-
            Kind of file: FILE_TYPE_PDF (signed PDF), FILE_TYPE_PREVIEW (print
            form,
             «Печатная форма»), FILE_TYPE_DDCARD («КЭД» card), FILE_TYPE_DOCX (editable
             source), FILE_TYPE_JSON (machine-readable).
          enum:
            - FILE_TYPE_UNSPECIFIED
            - FILE_TYPE_PDF
            - FILE_TYPE_DOCX
            - FILE_TYPE_DDCARD
            - FILE_TYPE_PREVIEW
            - FILE_TYPE_JSON
          format: enum
          readOnly: true
          type: string
      type: object
    DocumentRoute:
      description: DocumentRoute is the approval/signing workflow attached to a document.
      properties:
        active:
          description: Whether this is the document's currently active route.
          readOnly: true
          type: boolean
        id:
          description: Route id (UUID).
          readOnly: true
          type: string
        status:
          description: Route lifecycle state.
          enum:
            - ROUTE_STATUS_UNSPECIFIED
            - ROUTE_STATUS_DRAFT
            - ROUTE_STATUS_ACTIVE
            - ROUTE_STATUS_COMPLETED
            - ROUTE_STATUS_CANCELLED
          format: enum
          readOnly: true
          type: string
        steps:
          description: The route's steps, in execution order.
          items:
            $ref: '#/components/schemas/DocumentRouteStep'
          readOnly: true
          type: array
      type: object
    DocumentRouteStep:
      description: >-
        DocumentRouteStep is one stage of a route: approval or signing by a set
        of
         participants.
      properties:
        id:
          description: Step id (UUID).
          readOnly: true
          type: string
        index:
          description: Position of the step in the route's execution order.
          format: int32
          readOnly: true
          type: integer
        participants:
          description: The step's participant slots.
          items:
            $ref: '#/components/schemas/DocumentRouteParticipant'
          readOnly: true
          type: array
        rule:
          description: 'Completion rule: all participants or any one of them.'
          enum:
            - STEP_RULE_UNSPECIFIED
            - STEP_RULE_ALL
            - STEP_RULE_ANY_ONE
          format: enum
          readOnly: true
          type: string
        status:
          description: Step state.
          enum:
            - STEP_STATUS_UNSPECIFIED
            - STEP_STATUS_PENDING
            - STEP_STATUS_ACTIVE
            - STEP_STATUS_COMPLETED
            - STEP_STATUS_SKIPPED
          format: enum
          readOnly: true
          type: string
        step_type:
          description: 'What the step''s participants do: approve or sign.'
          enum:
            - STEP_TYPE_UNSPECIFIED
            - STEP_TYPE_APPROVAL
            - STEP_TYPE_SIGNING
          format: enum
          readOnly: true
          type: string
      type: object
    DocumentRouteParticipant:
      description: DocumentRouteParticipant is one participant slot on a route step.
      properties:
        employee_id:
          description: The participant's employee id.
          readOnly: true
          type: string
        id:
          description: Participant id — pass this to SignDocument.
          readOnly: true
          type: string
        key_type:
          description: INDIVIDUAL or ORGANIZATION signing key, resolved for signing steps.
          readOnly: true
          type: string
        status:
          description: Slot state; ACTIVE means the participant may act now.
          enum:
            - PARTICIPANT_STATUS_UNSPECIFIED
            - PARTICIPANT_STATUS_PENDING
            - PARTICIPANT_STATUS_ACTIVE
            - PARTICIPANT_STATUS_COMPLETED
            - PARTICIPANT_STATUS_REJECTED
            - PARTICIPANT_STATUS_SKIPPED
            - PARTICIPANT_STATUS_REVOKED
            - PARTICIPANT_STATUS_CHANGE_REQUESTED
          format: enum
          readOnly: true
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: X-API-Key
      type: apiKey

````