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

# Reorder Documents by Envelope ID

> The **Reorder Documents by Envelope ID** endpoint reorders all documents associated with a specific envelope based on the order specified in the request body.
Documents are returned in an `items` array within the JSON response reflecting the new order.




## OpenAPI

````yaml https://api.gonitro.dev/openapi.json put /sign/envelopes/{envelopeID}/documents:reorder
openapi: 3.1.0
info:
  title: Nitro Sign Public API
  description: REST API for Nitro Sign
  version: '0.1'
servers:
  - url: https://api.gonitro.dev
security:
  - bearerAuth: []
paths:
  /sign/envelopes/{envelopeID}/documents:reorder:
    put:
      tags:
        - Sign
      summary: Reorder Documents by Envelope ID
      description: >
        The **Reorder Documents by Envelope ID** endpoint reorders all documents
        associated with a specific envelope based on the order specified in the
        request body.

        Documents are returned in an `items` array within the JSON response
        reflecting the new order.
      operationId: reorderDocuments
      parameters:
        - name: envelopeID
          in: path
          description: >-
            A unique UUIDv4 string that identifies the envelope in the Nitro
            system.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReorderDocumentsRequest'
        required: true
      responses:
        '200':
          description: Documents reordered successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PendingDocumentResponse'
                  - $ref: '#/components/schemas/UploadedDocumentResponse'
                  - $ref: '#/components/schemas/FailedDocumentResponse'
                  - $ref: '#/components/schemas/SignedDocumentResponse'
                  - $ref: '#/components/schemas/SealedDocumentResponse'
              examples:
                Reordered Documents Response Example:
                  description: Reordered Documents Response Example
                  value:
                    items:
                      - ID: 987e6543-e21b-12d3-a456-426614174999
                        name: First Document
                        statue: pending
                        createdAt: '2023-11-07T05:31:56Z'
                      - ID: bc58d090-1368-4764-96b2-e59f8e4c0e0c
                        name: Second Document
                        statue: pending
                        createdAt: '2023-11-08T05:31:56Z'
        '401':
          description: Unauthorized - Invalid or missing JWT token
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/UnauthorizedProblemDetail'
        '404':
          description: Envelope not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/NotFoundProblemDetail'
        '409':
          description: Envelope cannot be modified
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/EnvelopeInInvalidStateProblemDetail'
components:
  schemas:
    ReorderDocumentsRequest:
      type: object
      description: >
        The request body should contain an array named 'order' with the document
        IDs in the desired sequence.

        This will update the order of documents within the envelope according to
        the provided list.


        Example:

        ```json

        {
          "order": [
            "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "ffa85f64-5709-6562-g3fc-1c963f66afa5"
          ]
        }

        ```
      properties:
        order:
          type: array
          description: >-
            An array of document IDs representing the new order of documents
            within the envelope.
          items:
            type: string
            format: uuid
          title: order
    PendingDocumentResponse:
      type: object
      description: Response for a pending document
      properties:
        name:
          type: string
          description: Name of the file provided by the user.
          minLength: 1
        createdAt:
          type: string
          format: date-time
          description: UTC timestamp indicating when the document was created.
        status:
          type: string
          description: Current status of the document.
          enum:
            - pending
            - uploaded
            - failed
            - signed
            - sealed
        ID:
          type: string
          format: uuid
          description: Unique uuid identifier for the document.
          minLength: 1
      required:
        - ID
        - name
      title: Pending
    UploadedDocumentResponse:
      type: object
      description: Response for an uploaded document
      properties:
        name:
          type: string
          description: Name of the file provided by the user.
          minLength: 1
        createdAt:
          type: string
          format: date-time
          description: UTC timestamp indicating when the document was created.
        status:
          type: string
          description: Current status of the document.
          enum:
            - pending
            - uploaded
            - failed
            - signed
            - sealed
        sizeBytes:
          type: integer
          format: int64
          description: Size in bytes of the document.
        numPages:
          type: integer
          format: int32
          description: Number of pages of the document.
        ID:
          type: string
          format: uuid
          description: Unique uuid identifier for the document.
          minLength: 1
      required:
        - ID
        - name
      title: Uploaded
    FailedDocumentResponse:
      type: object
      description: Response for a failed document
      properties:
        name:
          type: string
          description: Name of the file provided by the user.
          minLength: 1
        createdAt:
          type: string
          format: date-time
          description: UTC timestamp indicating when the document was created.
        status:
          type: string
          description: Current status of the document.
          enum:
            - pending
            - uploaded
            - failed
            - signed
            - sealed
        sizeBytes:
          type: integer
          format: int64
          description: Size in bytes of the document.
        numPages:
          type: integer
          format: int32
          description: Number of pages of the document.
        failureReason:
          type: string
          description: The failure reason of the document.
        ID:
          type: string
          format: uuid
          description: Unique uuid identifier for the document.
          minLength: 1
      required:
        - ID
        - name
      title: Failed
    SignedDocumentResponse:
      type: object
      description: Response for a signed document
      properties:
        name:
          type: string
          description: Name of the file provided by the user.
          minLength: 1
        createdAt:
          type: string
          format: date-time
          description: UTC timestamp indicating when the document was created.
        status:
          type: string
          description: Current status of the document.
          enum:
            - pending
            - uploaded
            - failed
            - signed
            - sealed
        sizeBytes:
          type: integer
          format: int64
          description: Size in bytes of the document.
        numPages:
          type: integer
          format: int32
          description: Number of pages of the document.
        ID:
          type: string
          format: uuid
          description: Unique uuid identifier for the document.
          minLength: 1
      required:
        - ID
        - name
      title: Signed
    SealedDocumentResponse:
      type: object
      description: Response for a sealed document
      properties:
        name:
          type: string
          description: Name of the file provided by the user.
          minLength: 1
        createdAt:
          type: string
          format: date-time
          description: UTC timestamp indicating when the document was created.
        status:
          type: string
          description: Current status of the document.
          enum:
            - pending
            - uploaded
            - failed
            - signed
            - sealed
        sizeBytes:
          type: integer
          format: int64
          description: Size in bytes of the document.
        numPages:
          type: integer
          format: int32
          description: Number of pages of the document.
        ID:
          type: string
          format: uuid
          description: Unique uuid identifier for the document.
          minLength: 1
      required:
        - ID
        - name
      title: Sealed
    UnauthorizedProblemDetail:
      type: object
      description: Unauthorized error details
      example:
        type: >-
          https://developers.gonitro.com/docs/build-nitro/errors#401-unauthorized
        title: Unauthorized
        status: 401
        detail: Missing or invalid Authorization header
        instance: /sign/envelopes
      properties:
        type:
          type: string
          description: A URI reference that identifies the problem type
        title:
          type: string
          description: A short, human-readable summary of the problem type
        status:
          type: integer
          format: int32
          description: The HTTP status code
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence
        extensions:
          type: object
          additionalProperties: {}
          description: Additional problem-specific properties
    NotFoundProblemDetail:
      type: object
      description: Not Found error details
      example:
        type: https://developers.gonitro.com/docs/build-nitro/errors#404-not-found
        title: Not Found
        status: 404
        detail: Envelope with ID 'envelop-123' not found
        instance: /sign/envelopes/envelop-123
      properties:
        type:
          type: string
          description: A URI reference that identifies the problem type
        title:
          type: string
          description: A short, human-readable summary of the problem type
        status:
          type: integer
          format: int32
          description: The HTTP status code
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence
        extensions:
          type: object
          additionalProperties: {}
          description: Additional problem-specific properties
    EnvelopeInInvalidStateProblemDetail:
      type: object
      description: Envelope in invalid state
      example:
        type: https://developers.gonitro.com/docs/build-nitro/errors#409-conflict
        title: Conflict
        status: 409
        detail: Envelope in invalid state
        instance: /sign/envelopes/%s:send-for-signing
      properties:
        type:
          type: string
          description: A URI reference that identifies the problem type
        title:
          type: string
          description: A short, human-readable summary of the problem type
        status:
          type: integer
          format: int32
          description: The HTTP status code
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence
        extensions:
          type: object
          additionalProperties: {}
          description: Additional problem-specific properties
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````