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

# Create a letter

> Create a letter from a template or content blocks. Set `auto_send` to print and post immediately.



## OpenAPI

````yaml openapi-core.json POST /v1/letters
openapi: 3.1.0
info:
  title: Yorlet Core API
  description: Core platform APIs including buildings, customers, units, and tasks.
  version: 1.0.0
servers:
  - url: https://api.yorlet.com
    description: Production
  - url: https://api.yorlet.io
    description: Sandbox
security: []
paths:
  /v1/letters:
    post:
      tags:
        - Letters
      summary: Create a letter
      description: >-
        Create a letter from a template or content blocks. Set `auto_send` to
        print and post immediately.
      operationId: letters_create
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                address_position:
                  type: string
                  enum:
                    - left
                    - right
                  description: >-
                    Which side of page 1 the recipient address window is printed
                    on.
                auto_send:
                  type: boolean
                  default: false
                  description: >-
                    If true, the letter is printed and posted immediately after
                    creation.
                blocks:
                  type: array
                  items:
                    oneOf:
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - heading
                          content:
                            type: string
                            minLength: 1
                            description: >-
                              Heading text. Supports the same merge fields as
                              text blocks.
                        required:
                          - type
                          - content
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - signature
                          file:
                            type:
                              - string
                              - 'null'
                            description: >-
                              File ID of a signature image. When omitted, `name`
                              is printed in a signature style.
                          name:
                            type:
                              - string
                              - 'null'
                            description: >-
                              Name printed under the signature. Defaults to the
                              account name.
                        required:
                          - type
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - text
                          content:
                            type: string
                            minLength: 1
                            description: >-
                              Body text. Supports merge fields such as
                              `{{customer.name}}` and `{{owner.address}}`.
                        required:
                          - type
                          - content
                  description: >-
                    Content blocks. Required when `template` is omitted;
                    otherwise copied from the template.
                delivery_product:
                  type: string
                  enum:
                    - standard
                    - premium
                  default: standard
                  description: Postage product used when the letter is sent.
                name:
                  type: string
                  description: A name for this letter. Defaults to the template name.
                recipient:
                  type: object
                  properties:
                    customer:
                      type: string
                      description: The customer ID. Required when `type` is `customer`.
                    owner:
                      type: string
                      description: The owner ID. Required when `type` is `owner`.
                    type:
                      type: string
                      enum:
                        - customer
                        - owner
                      description: Who the letter is addressed to.
                  description: Who the letter is addressed to.
                  required:
                    - type
                template:
                  type: string
                  description: The ID of a letter template to copy content from.
                variables:
                  type: object
                  additionalProperties:
                    type:
                      - string
                      - 'null'
                  description: >-
                    Values for the template custom variables, keyed by variable
                    key.
              required:
                - recipient
      responses:
        '200':
          description: Returns the letter object if the request succeeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique identifier for the object.
                  created:
                    type: number
                    description: >-
                      Time at which the object was created. Measured in seconds
                      since the Unix epoch.
                  account:
                    type: string
                    description: >-
                      The account that the object belongs to. Only returned if
                      the request is made with a valid Yorlet-Context header.
                  deleted:
                    type: boolean
                    default: false
                    description: Only returned if the object has been deleted.
                  object:
                    type: string
                    enum:
                      - letter
                  address_position:
                    type: string
                    enum:
                      - left
                      - right
                    description: >-
                      Which side of page 1 the recipient address window is
                      printed on.
                  blocks:
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - heading
                            content:
                              type: string
                              minLength: 1
                              description: >-
                                Heading text. Supports the same merge fields as
                                text blocks.
                          required:
                            - type
                            - content
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - signature
                            file:
                              type:
                                - string
                                - 'null'
                              description: >-
                                File ID of a signature image. When omitted,
                                `name` is printed in a signature style.
                            name:
                              type:
                                - string
                                - 'null'
                              description: >-
                                Name printed under the signature. Defaults to
                                the account name.
                          required:
                            - type
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - text
                            content:
                              type: string
                              minLength: 1
                              description: >-
                                Body text. Supports merge fields such as
                                `{{customer.name}}` and `{{owner.address}}`.
                          required:
                            - type
                            - content
                    description: >-
                      Content blocks that will be printed. Snapshotted from the
                      template when one is used.
                  customer:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                      - type: 'null'
                    description: >-
                      The customer this letter is addressed to, when
                      `recipient_type` is `customer`.
                  delivery_error:
                    type:
                      - string
                      - 'null'
                    description: Why sending failed, if `status` is `failed`.
                  delivery_product:
                    type: string
                    enum:
                      - standard
                      - premium
                    description: Postage product used when the letter is sent.
                  name:
                    type:
                      - string
                      - 'null'
                    description: A name for this letter. Defaults to the template name.
                  owner:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                      - type: 'null'
                    description: >-
                      The owner this letter is addressed to, when
                      `recipient_type` is `owner`.
                  page_count:
                    type:
                      - integer
                      - 'null'
                    description: >-
                      Number of PDF pages in the letter, set when it is sent.
                      Extra pages beyond the first are billed separately.
                  recipient_type:
                    type: string
                    enum:
                      - customer
                      - owner
                    description: Who the letter is addressed to.
                  sent_at:
                    type:
                      - number
                      - 'null'
                    description: >-
                      Time at which the letter was submitted to for printing.
                      Measured in seconds since the Unix epoch.
                  status:
                    type: string
                    enum:
                      - draft
                      - sending
                      - sent
                      - canceled
                      - failed
                    description: The current status of the letter.
                  template:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                      - type: 'null'
                    description: The letter template this letter was created from, if any.
                  tracking_number:
                    type:
                      - string
                      - 'null'
                    description: Postal tracking number, when one is available.
                  variables:
                    type: object
                    additionalProperties:
                      type:
                        - string
                        - 'null'
                    description: >-
                      Values for the template custom variables, keyed by
                      variable key.
                required:
                  - id
                  - created
                  - object
                  - address_position
                  - blocks
                  - customer
                  - delivery_error
                  - delivery_product
                  - name
                  - owner
                  - page_count
                  - recipient_type
                  - sent_at
                  - status
                  - template
                  - tracking_number
                  - variables
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API Key authentication. Use "Bearer YOUR_API_KEY".

````