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

# Create a letter

> Creates a printed letter (up to ~3 pages, 8.5×11, #10 envelope) in `awaiting_payment` and returns a `checkout_url`.



## OpenAPI

````yaml /openapi.json post /letters
openapi: 3.1.0
info:
  title: Sendpaper API
  version: 1.0.0
  description: >-
    Print and mail postcards and letters to US addresses. Every order returns a
    checkout_url a person pays; nothing is printed until then. No API key
    required.
servers:
  - url: https://sendmypaper.com/v1
security: []
paths:
  /letters:
    post:
      summary: Create a letter
      description: >-
        Creates a printed letter (up to ~3 pages, 8.5×11, #10 envelope) in
        `awaiting_payment` and returns a `checkout_url`.
      operationId: createLetter
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLetter'
            example:
              to:
                name: Pat Lee
                line1: 500 Main St
                line2: Apt 4
                city: Boston
                state: MA
                zip: '02110'
              from:
                name: Alex Kim
                line1: 88 Pine Ave
                city: Denver
                state: CO
                zip: '80202'
              content:
                body: |-
                  Dear Pat,

                  Thank you for fixing the roof so quickly.

                  Best,
                  Alex
                font: serif
      responses:
        '200':
          description: 'Idempotency-Key already used: the original order is returned'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '201':
          description: Order created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '422':
          $ref: '#/components/responses/Invalid'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Any unique string. Retrying with the same key returns the original order
        instead of creating a duplicate.
      schema:
        type: string
        maxLength: 120
  schemas:
    CreateLetter:
      type: object
      required:
        - to
        - from
        - content
      properties:
        to:
          $ref: '#/components/schemas/Address'
        from:
          $ref: '#/components/schemas/Address'
        content:
          type: object
          required:
            - body
          properties:
            body:
              type: string
              maxLength: 9000
              description: Plain text; blank lines separate paragraphs
            font:
              type: string
              enum:
                - serif
                - sans
              default: serif
        customer_email:
          type: string
          format: email
        idempotency_key:
          type: string
    Order:
      type: object
      properties:
        id:
          type: string
          example: ord_8k2m4qz7c1x9b3vd
        object:
          type: string
          enum:
            - postcard
            - letter
        product:
          type: string
          enum:
            - postcard_4x6
            - postcard_6x9
            - letter
        status:
          type: string
          enum:
            - awaiting_payment
            - paid
            - printing
            - mailed
            - cancelled
            - refunded
        status_detail:
          type: string
        price:
          type: object
          properties:
            amount_cents:
              type: integer
            currency:
              type: string
            display:
              type: string
        to:
          $ref: '#/components/schemas/Address'
        from:
          $ref: '#/components/schemas/Address'
        content:
          type: object
        checkout_url:
          type:
            - string
            - 'null'
          description: Where the person pays. Null once paid or closed. Never expires.
        order_url:
          type: string
          description: Human-readable status page
        preview_url:
          type: string
          description: Exact print preview
        created_at:
          type: string
          format: date-time
        paid_at:
          type:
            - string
            - 'null'
          format: date-time
        mailed_at:
          type:
            - string
            - 'null'
          format: date-time
        events:
          type: array
          items:
            type: object
            properties:
              at:
                type: string
              status:
                type: string
              note:
                type: string
    Address:
      type: object
      required:
        - name
        - line1
        - city
        - state
        - zip
      properties:
        name:
          type: string
          maxLength: 60
        company:
          type: string
          maxLength: 60
        line1:
          type: string
          maxLength: 64
          description: Street address
        line2:
          type: string
          maxLength: 64
          description: Apartment, suite, unit
        city:
          type: string
          maxLength: 40
        state:
          type: string
          description: Two-letter US state or territory code
          example: CA
        zip:
          type: string
          pattern: ^\d{5}(-\d{4})?$
          example: '94105'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              example: invalid_request
            message:
              type: string
            fields:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
  responses:
    Invalid:
      description: Validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.