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

# Create an order

> Creates a letter, registered letter, telegram, mala direta, Sedex or e-Carta order. The required fields depend on `shipType`. PDF documents may be sent as base64, a URL or a multipart file upload.




## OpenAPI

````yaml /openapi/escrybe.en.yaml post /api/v2/post
openapi: 3.1.0
info:
  title: Escrybe API
  version: 1.0.0
  description: >
    REST API for the Escrybe platform — send physical letters, registered
    letters, telegrams and e-Carta through Brazilian Correios, dispatch legally
    registered e-mails, and send WhatsApp messages with certified timestamps.


    ## Authentication

    Every account has a personal **`securityToken`** (find it in the panel under
    *Account → API*). Three products use it differently:


    | Product | Scheme | How | |---------|--------|-----| | Letters / Telegram /
    e-Carta, Registered E-mail, Receipts | API token | Send `userSecurityToken`
    as a query/body parameter, or `securityToken` as a header | | WhatsApp |
    HTTP Basic | `Authorization: Basic base64(email:securityToken)` |


    > The letter and e-mail **read** routes (`get`, `balance`, `download`, >
    `delete`) take the token as the first URL **path** segment — e.g. >
    `/api/v2/get/{securityToken}/{job_id}`.


    ## Response envelopes

    Most endpoints reply with the standard envelope `{"status": <http code>,
    "status_message": "...", "data": ...}` — this covers Letters/Telegram,
    Registered E-mail, and the WhatsApp message and sender endpoints. The
    WhatsApp **template** endpoints (and template sync) use `{"code": <http
    code>, "status": "success|error", "message": "...", "data": ...,
    "request_id": "..."}`; the logo endpoint uses the same shape without
    `request_id`. See the schema of each endpoint.


    A request that is accepted returns an HTTP `200` with a success payload;
    validation problems return `400`, bad credentials `401`, and forbidden
    access `403`. Unsupported HTTP methods return `405`, repeated failed
    authentication attempts return `429`, and the letter and e-mail endpoints
    return `503` during maintenance windows.
  contact:
    name: Escrybe Support
    url: https://escrybe.com.br
servers:
  - url: https://app.escrybe.com.br
    description: Production
  - url: https://homolog.escrybe.com.br
    description: Staging
security:
  - securityTokenQuery: []
tags:
  - name: Letters & Telegram
    description: Create and manage letter, telegram and e-Carta orders (Correios).
  - name: Account & Favorites
    description: Account balance, saved contacts and sender logo.
  - name: Registered E-mail
    description: Send and track legally registered e-mails.
  - name: WhatsApp Messages
    description: Send WhatsApp messages and download certified-timestamp attestations.
  - name: WhatsApp Senders
    description: Manage WhatsApp Business numbers (senders).
  - name: WhatsApp Templates
    description: Create, sync and manage WhatsApp message templates.
  - name: Receipts
    description: Download legal receipts for any order.
paths:
  /api/v2/post:
    post:
      tags:
        - Letters & Telegram
      summary: Create an order
      description: >
        Creates a letter, registered letter, telegram, mala direta, Sedex or
        e-Carta order. The required fields depend on `shipType`. PDF documents
        may be sent as base64, a URL or a multipart file upload.
      operationId: createOrder
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateOrderRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateOrderRequest'
      responses:
        '200':
          description: Order accepted (or test validated)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2Envelope'
              examples:
                accepted:
                  summary: Order accepted — data is the numeric visual id
                  value:
                    status: 200
                    status_message: Sucesso - pedido aceito
                    data: '2607031'
                test:
                  summary: test=1 — validated only; data carries the calculated price
                  value:
                    status: 200
                    status_message: >-
                      Sucesso como teste. Os dados e arquivo enviados sao
                      validos e seu pedido seria aceito se nao fosse um teste.
                    data:
                      value: 12.34
        '400':
          $ref: '#/components/responses/V2BadRequest'
        '401':
          $ref: '#/components/responses/V2Unauthorized'
        '500':
          $ref: '#/components/responses/V2ServerError'
        '503':
          $ref: '#/components/responses/V2Maintenance'
      security: []
components:
  schemas:
    CreateOrderRequest:
      type: object
      required:
        - userSecurityToken
        - shipType
        - name
        - addr1
        - street_number
        - zip
        - city
        - state
        - country
      properties:
        userSecurityToken:
          type: string
          description: Your account security token.
        shipType:
          type: integer
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
          description: >
            1 Carta Simples · 2 Carta Registrada · 3 Carta Registrada + AR · 4
            Telegrama · 5 Mala Direta · 6 Sedex · 7 Sedex + AR · 8 eCarta
            Simples · 9 eCarta Registrada · 10 eCarta Registrada + AR. Sedex (6,
            7) is only accepted with `virtualbox=1` or when the sender address
            is in Jaú/SP.
        paymentMethod:
          type: string
          enum:
            - escrybe_credits
            - invoice
            - team
          default: escrybe_credits
        team_member_id:
          type: integer
          description: Required when paymentMethod=team.
        ar_type:
          type: string
          enum:
            - physical
            - electronic
          default: physical
          description: '`electronic` is only allowed for shipTypes 3, 7 and 10.'
        virtualbox:
          type: string
          enum:
            - '0'
            - '1'
          default: '0'
          description: >
            Virtual Box service — when 1 (or "true"), the sender address is
            replaced by Escrybe's facility (Jaú/SP) and Virtual Box pricing
            applies.
        name:
          type: string
          maxLength: 60
          description: Recipient name.
        addr1:
          type: string
          maxLength: 60
        street_number:
          type: string
          maxLength: 15
        addr2:
          type: string
          maxLength: 40
        zip:
          type: string
          description: >-
            Recipient ZIP (CEP). Validated against Correios for Brazilian
            addresses; the state is cross-checked against the CEP.
        city:
          type: string
          maxLength: 40
        state:
          type: string
          maxLength: 40
          description: For Brazilian addresses this must be the 2-letter UF (e.g. SP).
        country:
          type: string
          maxLength: 60
        name_sender:
          type: string
          maxLength: 60
          description: Falls back to your profile when omitted.
        addr1_sender:
          type: string
          maxLength: 60
        street_number_sender:
          type: string
          maxLength: 15
        addr2_sender:
          type: string
          maxLength: 40
        zip_sender:
          type: string
        city_sender:
          type: string
          maxLength: 40
        state_sender:
          type: string
          maxLength: 40
        country_sender:
          type: string
          maxLength: 60
        toAddrOnly:
          type: integer
          enum:
            - 0
            - 1
          default: 0
          description: Only honored for shipTypes 2, 3, 6, 7 and 10; forced to 0 otherwise.
        tag:
          type: string
          description: Free-form label for your own reference.
        test:
          type: integer
          enum:
            - 0
            - 1
          default: 0
          description: >-
            When 1, validates without creating the order and returns the
            calculated price.
        pdfFile:
          type: string
          description: >
            Required for shipTypes 1,2,3,5,6,7. base64 string, URL (public
            Google Docs/Drive links supported), or multipart file. Max 150
            pages; password-protected PDFs are rejected.
        duplex_printing:
          type: integer
          enum:
            - 0
            - 1
          default: 1
          description: >-
            Also accepts "true"/"false". Forced to 1 for single-page PDFs and to
            0 when envelope_type=autoenvelope.
        envelope_type:
          type: string
          enum:
            - regular
            - autoenvelope
          default: regular
          description: '`autoenvelope` requires a single-page PDF.'
        telegram_msg:
          type: string
          description: >-
            Required for shipType=4. Min 10 chars; rendered content limited to
            10 pages.
        telegram_post_dated:
          type: integer
          enum:
            - 0
            - 1
          description: Required (0 or 1) when shipType=4.
        telegram_post_dated_date:
          type: string
          format: date
          description: >-
            Required when telegram_post_dated=1; must be a future date (tomorrow
            or later).
        telegram_sender_copy:
          type: integer
          enum:
            - 0
            - 1
          description: Required (0 or 1) when shipType=4.
        telegram_delivery_confirmation:
          type: integer
          enum:
            - 0
            - 1
          description: Required (0 or 1) when shipType=4.
        ecarta_msg:
          type: string
          description: >-
            Required for shipTypes 8,9,10. Min 10 chars; may contain HTML.
            Rendered content limited to 10 pages.
        use_client_contract:
          type: string
          enum:
            - '0'
            - '1'
          default: '0'
          description: >
            Bill shipping through your own Correios contract. Only for shipTypes
            2,3,4,6,7,8,9,10; requires a PJ account with a Correios contract
            number/card and a plan that allows it.
    V2Envelope:
      type: object
      properties:
        status:
          type: integer
          example: 200
        status_message:
          type: string
        data:
          oneOf:
            - type: object
            - type: string
            - type: 'null'
  responses:
    V2BadRequest:
      description: Invalid or incomplete request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Envelope'
          example:
            status: 400
            status_message: Requisição incompleta
            data: null
    V2Unauthorized:
      description: Invalid token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Envelope'
          example:
            status: 401
            status_message: Token inválido
            data: null
    V2ServerError:
      description: Internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Envelope'
    V2Maintenance:
      description: Server under maintenance
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Envelope'
  securitySchemes:
    securityTokenQuery:
      type: apiKey
      in: query
      name: userSecurityToken
      description: >-
        Your account security token, sent as the `userSecurityToken` query or
        form parameter.

````