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

# Get letter

> Return one of your letters, fully reconciled: pending legs are probed
and verified, an overdue letter is expired and its refund submitted,
and for `MAILED` letters Lob's status, tracking number, expected
delivery date and tracking events are refreshed (at most every 15
minutes, best effort). This is the owner's polling target.

`claimCode` and `claimUrl` are included while the letter is
non-terminal (`DRAFT`, `ESCROWED`, `MAILED`, `CLAIMING`).




## OpenAPI

````yaml /api-reference/openapi.yaml get /transfer/letter/{id}
openapi: 3.1.0
info:
  title: AroPay API
  version: 1.0.0
  description: |
    The AroPay API for orchestrating sealed, private payments on public
    ledgers, built on the Aro Confidential Rails (Zama Protocol FHE). Two
    environments run the same API: Production on Ethereum Mainnet
    (`aropay.aro.media`, real funds) and the Sandbox on Sepolia
    (`dev.aropay.aro.media`, test funds and a faucet). Integrations built
    against the sandbox carry over unchanged; the faucet (`POST /fund`) is
    sandbox-only and returns 404 on production.

    Every response (except the flat Sandbox probes)
    uses the shared envelope: `{ "ok": true, "data": … }` on success and
    `{ "ok": false, "error": { "code", "message", "details?" } }` on failure.

    Amounts are decimal strings in human units (e.g. `"125.50"`). Write
    requests must send `Content-Type: application/json`.
  contact:
    name: Aro Media
    url: https://aro.media
servers:
  - url: https://aropay.aro.media/api/v1
    description: Production (Ethereum Mainnet)
  - url: https://dev.aropay.aro.media/api/v1
    description: Sandbox (Sepolia)
  - url: http://aropay.localhost:3000/api/v1
    description: Local development
security:
  - apiKeyAuth: []
  - sessionCookie: []
tags:
  - name: Auth
    description: Password, TOTP, and passkey login; session inspection and logout.
  - name: Profile & security
    description: Profile, password, two-factor authentication, and passkey management.
    x-group: Profile & security
  - name: API keys
    description: Programmatic credentials. Creation and revocation are session-only.
  - name: Wallets
    description: Custodial and external (watch-only) wallets.
  - name: Balances
    description: Balance triples and lightweight gas reads.
  - name: Money movement
    description: |
      Faucet funding, minting, transfers, and redemptions. All four are
      asynchronous: the request is validated and recorded, the response is
      `201` with the transaction in status `QUEUED` (`txHash: null`), and a
      background worker executes it. Poll `GET /transactions/{id}` until
      `status` is `CONFIRMED`, `SETTLED`, or `FAILED`. Execution failures
      surface as status `FAILED` with `errorCode` on the transaction, never
      as an HTTP error on the POST.
  - name: Aro Mail
    description: >-
      Letters of value: escrow cAROUSD, print or mail through Lob, and let the
      recipient claim by QR or code.
  - name: Transactions
    description: >-
      History, single-transaction reads (pure database reads), and notarized
      receipts.
  - name: Sandbox
    description: Unauthenticated status and echo probes with a flat response shape.
paths:
  /transfer/letter/{id}:
    get:
      tags:
        - Aro Mail
      summary: Get letter
      description: |
        Return one of your letters, fully reconciled: pending legs are probed
        and verified, an overdue letter is expired and its refund submitted,
        and for `MAILED` letters Lob's status, tracking number, expected
        delivery date and tracking events are refreshed (at most every 15
        minutes, best effort). This is the owner's polling target.

        `claimCode` and `claimUrl` are included while the letter is
        non-terminal (`DRAFT`, `ESCROWED`, `MAILED`, `CLAIMING`).
      operationId: getLetter
      parameters:
        - $ref: '#/components/parameters/LetterId'
      responses:
        '200':
          description: The letter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LetterEnvelope'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/AccountDisabled'
        '404':
          $ref: '#/components/responses/LetterNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    LetterId:
      name: id
      in: path
      required: true
      schema:
        type: string
      description: Letter ID.
  schemas:
    LetterEnvelope:
      type: object
      required:
        - ok
        - data
      properties:
        ok:
          const: true
        data:
          type: object
          required:
            - letter
          properties:
            letter:
              $ref: '#/components/schemas/Letter'
    Letter:
      type: object
      description: |
        An Aro Mail letter: escrowed cAROUSD, a recipient address, a one-time
        claim code, and the legs that moved value.
      required:
        - id
        - status
        - chainId
        - amount
        - token
        - amountVisibility
        - memo
        - recipient
        - isDomestic
        - expiresAt
        - sender
        - claimCode
        - claimUrl
        - pdfUrl
        - escrow
        - claim
        - refund
        - mail
        - needsReview
        - error
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          examples:
            - cklet0001abcd
        status:
          type: string
          enum:
            - DRAFT
            - ESCROWED
            - MAILED
            - CLAIMING
            - CLAIMED
            - EXPIRED
            - VOIDED
            - FAILED
          description: |
            `DRAFT` (escrow submitted) → `ESCROWED` (escrow verified) →
            optional `MAILED` → `CLAIMING` → `CLAIMED`. `EXPIRED` and `VOIDED`
            carry a refund leg. `FAILED` means the escrow reverted, clamped or
            was never submitted: no value left the sender. Claimable:
            `ESCROWED`, `MAILED`. Terminal: `CLAIMED`, `EXPIRED`, `VOIDED`,
            `FAILED`.
        chainId:
          type: integer
          examples:
            - 11155111
        amount:
          type: string
          description: >-
            Decimal string in human units. Cleartext to the parties; encrypted
            on-chain.
        token:
          type: string
          examples:
            - cAROUSD
        amountVisibility:
          type: string
          enum:
            - sealed
            - visible
          description: >-
            Whether the printed letter shows the amount. Defaults to `visible`
            domestic, `sealed` international.
        memo:
          type:
            - string
            - 'null'
          description: Up to 200 characters, printed on the letter.
        recipient:
          type: object
          required:
            - name
            - address
          properties:
            name:
              type: string
            address:
              $ref: '#/components/schemas/LetterAddress'
        isDomestic:
          type: boolean
          description: >-
            True when the destination is the deployment's home country (`US` by
            default).
        expiresAt:
          type: string
          format: date-time
        sender:
          type: object
          required:
            - walletId
            - address
          properties:
            walletId:
              type:
                - string
                - 'null'
              description: >-
                The sending wallet; `null` if that wallet was later deleted
                (refunds still go to `address`).
            address:
              type: string
              description: EIP-55 address the escrow came from and refunds return to.
        claimCode:
          type:
            - string
            - 'null'
          description: |
            Display form (`XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX`, 28 Crockford
            base32 symbols incl. two check symbols). Owner-only: present on
            create and single reads while the letter is non-terminal; `null`
            in lists and once terminal.
        claimUrl:
          type:
            - string
            - 'null'
          description: >-
            `https://<aropay-host>/claim#<code>`; the QR payload. Same
            visibility as `claimCode`.
        pdfUrl:
          type: string
          description: >-
            Absolute URL of `GET /transfer/letter/{id}/pdf`, built from the
            claim origin fixed at creation.
        escrow:
          description: >-
            The `LETTER_ESCROW` leg (sender → vault); `null` only if the row was
            never created.
          oneOf:
            - $ref: '#/components/schemas/LetterLeg'
            - type: 'null'
        claim:
          description: >-
            The `LETTER_CLAIM` leg (vault → recipient wallet); `null` until
            someone claims.
          oneOf:
            - allOf:
                - $ref: '#/components/schemas/LetterLeg'
                - type: object
                  required:
                    - claimedAt
                    - walletAddress
                  properties:
                    claimedAt:
                      type:
                        - string
                        - 'null'
                      format: date-time
                      description: Set when the letter reaches `CLAIMED`.
                    walletAddress:
                      type:
                        - string
                        - 'null'
                      description: The wallet the value was released to.
            - type: 'null'
        refund:
          description: >-
            The `LETTER_REFUND` leg (vault → sender address); `null` unless the
            letter was voided or expired.
          oneOf:
            - allOf:
                - $ref: '#/components/schemas/LetterLeg'
                - type: object
                  required:
                    - reason
                  properties:
                    reason:
                      type: string
                      enum:
                        - voided
                        - expired
            - type: 'null'
        mail:
          description: >-
            Fulfilment details; `null` until `POST /transfer/letter/{id}/mail`
            is attempted.
          oneOf:
            - type: object
              required:
                - provider
                - providerId
                - deliveryMethod
                - status
                - trackingNumber
                - expectedDeliveryDate
                - mailedAt
                - testMode
              properties:
                provider:
                  type: string
                  examples:
                    - lob
                providerId:
                  type:
                    - string
                    - 'null'
                  description: Lob letter id once accepted.
                deliveryMethod:
                  type:
                    - string
                    - 'null'
                  enum:
                    - standard
                    - tracked
                    - courier
                    - null
                status:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Lob letter status (`processed`, `rendered`, `failed`),
                    refreshed on owner reads.
                trackingNumber:
                  type:
                    - string
                    - 'null'
                  description: >-
                    USPS tracking number for `tracked` letters (dummy in test
                    mode).
                expectedDeliveryDate:
                  type:
                    - string
                    - 'null'
                  description: Lob's estimate, `YYYY-MM-DD`.
                mailedAt:
                  type:
                    - string
                    - 'null'
                  format: date-time
                testMode:
                  type: boolean
                  description: >-
                    True when the deployment uses a Lob test key; nothing is
                    printed or mailed.
            - type: 'null'
        needsReview:
          type: boolean
          description: >-
            True when a leg could not be verified automatically; nothing moves
            until an operator reviews `error`.
        error:
          type:
            - string
            - 'null'
          description: Failure or review context for the most recent leg.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      description: The shared failure envelope.
      required:
        - ok
        - error
      properties:
        ok:
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable error code; match on this, not `message`.
            message:
              type: string
            details:
              description: Structured context, e.g. per-field validation issues.
    LetterAddress:
      type: object
      description: Recipient postal address as stored, with the resolved country name.
      required:
        - line1
        - line2
        - landmark
        - city
        - region
        - postal
        - country
        - countryName
      properties:
        line1:
          type: string
        line2:
          type:
            - string
            - 'null'
        landmark:
          type:
            - string
            - 'null'
          description: Printed as `Near …` on the letter.
        city:
          type: string
        region:
          type:
            - string
            - 'null'
        postal:
          type:
            - string
            - 'null'
        country:
          type: string
          description: ISO 3166-1 alpha-2, upper-case.
          examples:
            - NG
        countryName:
          type: string
          examples:
            - Nigeria
    LetterLeg:
      type: object
      description: >-
        One on-chain leg of a letter (escrow, release or refund), linked to its
        transaction row.
      required:
        - transactionId
        - txHash
        - explorerUrl
        - status
        - verified
      properties:
        transactionId:
          type: string
          description: The `Transaction` id; read it with `GET /transactions/{id}`.
          examples:
            - cktxn0005abcd
        txHash:
          type:
            - string
            - 'null'
        explorerUrl:
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - PENDING
            - CONFIRMED
            - SETTLING
            - SETTLED
            - FAILED
          description: The linked transaction's status.
        verified:
          type: boolean
          description: |
            True once the leg's `ConfidentialTransfer` event was decrypted and
            matched the letter amount. The letter only changes status after
            verification, so `CONFIRMED` + `verified: false` means the receipt
            is in and verification is pending.
  responses:
    Unauthorized:
      description: Missing or invalid credential.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error:
              code: invalid_api_key
              message: Invalid API key.
    AccountDisabled:
      description: The account has been deactivated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error:
              code: account_disabled
              message: This account is disabled.
    LetterNotFound:
      description: >-
        No letter with this id in your account (or no letter matches the claim
        code).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error:
              code: letter_not_found
              message: Letter not found.
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error:
              code: rate_limited
              message: Too many requests. Try again shortly.
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error:
              code: internal_error
              message: An unexpected error occurred.
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: aro_sk_…
      description: |
        AroPay API key, sent as `Authorization: Bearer aro_sk_…`. Created in
        the dashboard under Settings → API keys. Takes precedence over a
        session cookie when both are present.
      x-default: aro_sk_your_key_here
    sessionCookie:
      type: apiKey
      in: cookie
      name: aropay_session
      description: |
        Browser session cookie minted by `POST /auth/login` (or passkey
        login). httpOnly, `SameSite=Lax`, 24 h TTL. Endpoints marked
        **Session-only** accept only this credential and return
        `403 session_required` for API keys.

````