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

# Create an envelope from a template

> Requires a recipient for every template role. By default auto-sends because the layout was reviewed at save time; pass autoSend: false for a review-first draft. Supports the optional Idempotency-Key header. Repeating the same key and request replays the original 201 response; a key currently in flight returns 409, and reusing a key with a different request returns 422.



## OpenAPI

````yaml /openapi.json post /api/v1/templates/{id}/envelopes
openapi: 3.0.0
info:
  title: Atlas API
  version: 0.0.0
servers:
  - url: https://api.atlaswork.ai
security: []
paths:
  /api/v1/templates/{id}/envelopes:
    post:
      tags:
        - Templates
      summary: Create an envelope from a template
      description: >-
        Requires a recipient for every template role. By default auto-sends
        because the layout was reviewed at save time; pass autoSend: false for a
        review-first draft. Supports the optional Idempotency-Key header.
        Repeating the same key and request replays the original 201 response; a
        key currently in flight returns 409, and reusing a key with a different
        request returns 422.
      parameters:
        - schema:
            type: string
            minLength: 1
            description: Template id
          required: true
          description: Template id
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                recipients:
                  type: object
                  additionalProperties:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                      email:
                        type: string
                        format: email
                      order:
                        type: integer
                        minimum: 1
                      company:
                        type: string
                        nullable: true
                        maxLength: 200
                      title:
                        type: string
                        nullable: true
                        maxLength: 200
                    required:
                      - email
                prefill:
                  type: object
                  additionalProperties:
                    type: string
                displayName:
                  type: string
                  minLength: 1
                  maxLength: 255
                autoSend:
                  type: boolean
                senderOrder:
                  type: integer
                  minimum: 1
              required:
                - recipients
      responses:
        '201':
          description: Instantiated envelope
          content:
            application/json:
              schema:
                anyOf:
                  - 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
                  - 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
                      reviewUrl:
                        type: string
                      note:
                        type: string
                      prefillUnmatched:
                        type: array
                        items:
                          type: string
                    required:
                      - envelope
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '402':
          description: Insufficient send credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '404':
          description: Template 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
        '409':
          description: An idempotent request with this key is already in flight
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '422':
          description: Recipients or prefill values are invalid
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - code
                  - message
        '502':
          description: Document storage copy failed
          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.

````