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

# Complete a deferred document upload

> Verify that deferred PDF/DOCX bytes reached storage, anchor their hash and size, and enqueue field detection. Repeating a completed upload is safe.



## OpenAPI

````yaml /openapi.json post /api/v1/envelopes/{id}/upload/complete
openapi: 3.0.0
info:
  title: Atlas API
  version: 0.0.0
servers:
  - url: https://api.atlaswork.ai
security: []
paths:
  /api/v1/envelopes/{id}/upload/complete:
    post:
      tags:
        - envelopes
      summary: Complete a deferred document upload
      description: >-
        Verify that deferred PDF/DOCX bytes reached storage, anchor their hash
        and size, and enqueue field detection. Repeating a completed upload is
        safe.
      parameters:
        - schema:
            type: string
            minLength: 1
            description: Envelope id
          required: true
          description: Envelope id
          name: id
          in: path
      responses:
        '200':
          description: Upload anchored and detection requested
          content:
            application/json:
              schema:
                type: object
                properties:
                  envelope:
                    type: object
                    properties:
                      envelope:
                        type: object
                        properties:
                          id:
                            type: string
                          organizationId:
                            type: string
                          teamId:
                            type: string
                          templateId:
                            type: string
                            nullable: true
                          templateContentHash:
                            type: string
                            nullable: true
                          status:
                            type: string
                            enum:
                              - draft
                              - detecting
                              - review
                              - in_progress
                              - completed
                              - declined
                              - voided
                              - expired
                          detectionStatus:
                            type: string
                            enum:
                              - none
                              - running
                              - succeeded
                              - failed
                          version:
                            type: integer
                          originalFilename:
                            type: string
                            nullable: true
                          displayName:
                            type: string
                            nullable: true
                          sourceFormat:
                            type: string
                            nullable: true
                          contentHash:
                            type: string
                            nullable: true
                          sizeBytes:
                            type: number
                            nullable: true
                          deliveryMode:
                            type: string
                          legalFramework:
                            type: string
                            nullable: true
                          consumerDisclosure:
                            type: boolean
                          expiresAt:
                            type: string
                            nullable: true
                            format: date-time
                          scheduledSendAt:
                            type: string
                            nullable: true
                            format: date-time
                          reminderPolicy:
                            nullable: true
                          sentAt:
                            type: string
                            nullable: true
                            format: date-time
                          completedAt:
                            type: string
                            nullable: true
                            format: date-time
                          declinedAt:
                            type: string
                            nullable: true
                            format: date-time
                          voidedAt:
                            type: string
                            nullable: true
                            format: date-time
                          expiredAt:
                            type: string
                            nullable: true
                            format: date-time
                          metadata:
                            nullable: true
                          senderUserId:
                            type: string
                            nullable: true
                          senderName:
                            type: string
                            nullable: true
                          senderEmail:
                            type: string
                            nullable: true
                          detectedParties:
                            nullable: true
                          createdAt:
                            type: string
                            format: date-time
                          updatedAt:
                            type: string
                            format: date-time
                        required:
                          - id
                          - organizationId
                          - teamId
                          - templateId
                          - templateContentHash
                          - status
                          - detectionStatus
                          - version
                          - originalFilename
                          - displayName
                          - sourceFormat
                          - contentHash
                          - sizeBytes
                          - deliveryMode
                          - legalFramework
                          - consumerDisclosure
                          - expiresAt
                          - scheduledSendAt
                          - sentAt
                          - completedAt
                          - declinedAt
                          - voidedAt
                          - expiredAt
                          - createdAt
                          - updatedAt
                      participants:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            envelopeId:
                              type: string
                            organizationId:
                              type: string
                            orderIndex:
                              type: integer
                            name:
                              type: string
                            email:
                              type: string
                            company:
                              type: string
                              nullable: true
                            title:
                              type: string
                              nullable: true
                            status:
                              type: string
                              enum:
                                - pending
                                - signed
                                - declined
                            detectedPartyIndex:
                              type: integer
                              nullable: true
                            consentedAt:
                              type: string
                              nullable: true
                              format: date-time
                            signedAt:
                              type: string
                              nullable: true
                              format: date-time
                            declinedAt:
                              type: string
                              nullable: true
                              format: date-time
                            declineReason:
                              type: string
                              nullable: true
                            lastViewedAt:
                              type: string
                              nullable: true
                              format: date-time
                            lastIpAddress:
                              type: string
                              nullable: true
                            lastUserAgent:
                              type: string
                              nullable: true
                            createdAt:
                              type: string
                              format: date-time
                            updatedAt:
                              type: string
                              format: date-time
                          required:
                            - id
                            - envelopeId
                            - organizationId
                            - orderIndex
                            - name
                            - email
                            - status
                            - consentedAt
                            - signedAt
                            - declinedAt
                            - declineReason
                            - lastViewedAt
                            - lastIpAddress
                            - lastUserAgent
                            - createdAt
                            - updatedAt
                      fields:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            envelopeId:
                              type: string
                            organizationId:
                              type: string
                            participantId:
                              type: string
                              nullable: true
                            partyIndex:
                              type: integer
                              nullable: true
                            type:
                              type: string
                              enum:
                                - signature
                                - initials
                                - date
                                - text
                                - checkbox
                            page:
                              type: integer
                            x:
                              type: number
                            'y':
                              type: number
                            width:
                              type: number
                            height:
                              type: number
                            label:
                              type: string
                              nullable: true
                            required:
                              type: boolean
                            source:
                              type: string
                              enum:
                                - detected
                                - manual
                                - template
                            prefillValue:
                              type: string
                              nullable: true
                            locked:
                              type: boolean
                            autoSource:
                              type: string
                              nullable: true
                              enum:
                                - signed_date
                                - participant_name
                                - participant_email
                                - participant_company
                                - participant_title
                                - sender_org_name
                                - null
                            proposedAutoSource:
                              type: string
                              nullable: true
                              enum:
                                - signed_date
                                - participant_name
                                - participant_email
                                - participant_company
                                - participant_title
                                - sender_org_name
                                - null
                            value:
                              type: string
                              nullable: true
                            filledAt:
                              type: string
                              nullable: true
                              format: date-time
                            createdAt:
                              type: string
                              format: date-time
                            updatedAt:
                              type: string
                              format: date-time
                          required:
                            - id
                            - envelopeId
                            - organizationId
                            - participantId
                            - type
                            - page
                            - x
                            - 'y'
                            - width
                            - height
                            - label
                            - required
                            - source
                            - prefillValue
                            - locked
                            - autoSource
                            - proposedAutoSource
                            - value
                            - filledAt
                            - createdAt
                            - updatedAt
                    required:
                      - envelope
                      - participants
                      - fields
                  documentReceived:
                    type: boolean
                    enum:
                      - true
                  detectionRequested:
                    type: boolean
                required:
                  - envelope
                  - documentReceived
                  - detectionRequested
        '401':
          description: Missing or invalid API key or OAuth access token
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '403':
          description: Credential lacks envelopes:write or documents:write
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '404':
          description: Envelope not found in this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '422':
          description: Document has not arrived or is not a supported PDF/DOCX
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
      security:
        - apiKey: []
        - oauthJwt: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Organization API key (format `atlas_sk_...`), passed as a bearer token
        or the x-api-key header. Created and revoked in the dashboard (Better
        Auth api-key plugin); shown in full only once and stored hashed.
    oauthJwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Better Auth OAuth resource access token. The token audience must match
        the Atlas MCP resource and include the scope required by the route.

````