> ## 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.

# Update Document by ID

> The **Update Document by ID** endpoint allows you to update an existing document's metadata within an envelope.
This endpoint performs a partial update on the document, changing only the provided fields while preserving all other properties.
Currently, only the document name can be updated.




## OpenAPI

````yaml https://api.gonitro.dev/openapi.json patch /sign/envelopes/{envelopeID}/documents/{documentID}
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/{documentID}:
    patch:
      tags:
        - Sign
      summary: Update Document by ID
      description: >
        The **Update Document by ID** endpoint allows you to update an existing
        document's metadata within an envelope.

        This endpoint performs a partial update on the document, changing only
        the provided fields while preserving all other properties.

        Currently, only the document name can be updated.
      operationId: updateDocument
      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
        - name: documentID
          in: path
          description: A unique string that identifies the document in the Nitro system.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RenameDocumentRequest'
        required: true
      responses:
        '200':
          description: Document updated successfully
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PendingDocumentResponse'
                  - $ref: '#/components/schemas/UploadedDocumentResponse'
        '400':
          description: Invalid document metadata
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/BadRequestProblemDetail'
        '401':
          description: Unauthorized - Invalid or missing JWT token
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/UnauthorizedProblemDetail'
        '404':
          description: Document or envelope not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/DocumentNotFoundProblemDetail'
        '409':
          description: Envelope cannot be modified
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/EnvelopeInInvalidStateProblemDetail'
components:
  schemas:
    RenameDocumentRequest:
      type: object
      properties:
        name:
          type: string
          description: The new name for the document
          example: Updated Document Name.pdf
          maxLength: 255
          minLength: 1
      required:
        - name
    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
    BadRequestProblemDetail:
      type: object
      description: Bad Request error details
      example:
        type: https://developers.gonitro.com/docs/build-nitro/errors#400-bad-request
        title: Bad Request
        status: 400
        detail: Request validation failed
        instance: /sign/envelopes
        validation_errors:
          name: must not be blank
      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
    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
    DocumentNotFoundProblemDetail:
      type: object
      description: Document Not Found error details
      example:
        type: https://developers.gonitro.com/docs/build-nitro/errors#404-not-found
        title: Document not Found
        status: 404
        detail: Document with ID 'document-123' not found
        instance: /sign/envelopes/envelop-123/documents/doc-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

````