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

# Wyślij szkic

> Składa zamówienie ze szkicu. Paperjoy sprawdza szkic tak jak nową pocztówkę, także pod kątem zmieszczenia na kartce i kopercie, pobiera jeden kredyt (tylko live), ustawia `status` na `new` i `submitted_at`. Gdy sprawdzenie się nie powiedzie (`422`) albo brakuje kredytów (`402`), pocztówka zostaje szkicem i nic nie jest pobierane.

Wymaga nagłówka `Idempotency-Key`; ponowienie z tym samym kluczem zwraca pierwotną odpowiedź i nie pobiera drugiego kredytu. Wlicza się do dziennego limitu 100 pocztówek. Wymaga uprawnienia `postcards:write`.




## OpenAPI

````yaml /openapi.yaml post /api/postcards/{id}/submit
openapi: 3.1.0
info:
  title: Paperjoy API
  version: '2026-10-19'
  description: >-
    Twórz, podglądaj i śledź prawdziwe, ręcznie pisane pocztówki. Klucz API
    decyduje, czy żądanie działa w trybie testowym, czy live.
  termsOfService: https://paperjoy.co/regulamin
  license:
    name: Proprietary
    url: https://paperjoy.co/regulamin
servers:
  - url: https://paperjoy.co
security:
  - bearerAuth: []
tags:
  - name: Konto
    description: Uwierzytelnione konto i saldo kredytów.
  - name: Pocztówki
    description: Tworzenie, podgląd, lista i pobieranie pocztówek.
  - name: Podpisy
    description: Własne podpisy odręczne Twojej organizacji.
paths:
  /api/postcards/{id}/submit:
    post:
      tags:
        - Pocztówki
      summary: Wyślij szkic
      description: >
        Składa zamówienie ze szkicu. Paperjoy sprawdza szkic tak jak nową
        pocztówkę, także pod kątem zmieszczenia na kartce i kopercie, pobiera
        jeden kredyt (tylko live), ustawia `status` na `new` i `submitted_at`.
        Gdy sprawdzenie się nie powiedzie (`422`) albo brakuje kredytów (`402`),
        pocztówka zostaje szkicem i nic nie jest pobierane.


        Wymaga nagłówka `Idempotency-Key`; ponowienie z tym samym kluczem zwraca
        pierwotną odpowiedź i nie pobiera drugiego kredytu. Wlicza się do
        dziennego limitu 100 pocztówek. Wymaga uprawnienia `postcards:write`.
      operationId: submitPostcard
      parameters:
        - $ref: '#/components/parameters/PostcardId'
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            Unikalny klucz tej wysyłki. Paperjoy pamięta udane odpowiedzi przez
            7 dni.
          schema:
            type: string
            maxLength: 255
          example: submit-order-1042
      responses:
        '200':
          description: Zamówienie zostało złożone.
          headers:
            Idempotency-Relayed:
              description: >-
                Obecny, gdy odpowiedź jest odtworzeniem wcześniejszej odpowiedzi
                dla tego samego `Idempotency-Key`.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostcardResponse'
        '400':
          $ref: '#/components/responses/MissingIdempotencyKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/NotDraft'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    PostcardId:
      name: id
      in: path
      required: true
      description: ID pocztówki.
      schema:
        type: string
        examples:
          - pc_MXP7a4Ni0c
  schemas:
    PostcardResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/Postcard'
    Postcard:
      type: object
      required:
        - id
        - test_mode
        - recipient
        - signature
        - signature_id
        - mistake
        - status
        - submitted_at
        - sent_at
        - created_at
        - updated_at
      properties:
        id:
          type: string
          examples:
            - pc_MXP7a4Ni0c
        test_mode:
          type: boolean
          description: >-
            `true` dla pocztówki testowej. Pocztówki testowe są darmowe i nigdy
            nie są pisane ani wysyłane.
        address:
          description: Adres dostawy. Może być `null` tylko w szkicu.
          oneOf:
            - $ref: '#/components/schemas/Address'
            - type: 'null'
        recipient:
          oneOf:
            - $ref: '#/components/schemas/Recipient'
            - type: 'null'
        content:
          type:
            - string
            - 'null'
          maxLength: 300
          description: Treść kartki. Może być `null` tylko w szkicu.
        signature:
          type:
            - string
            - 'null'
          maxLength: 50
          description: Wpisany podpis albo `null`, gdy pocztówka używa własnego podpisu.
        signature_id:
          type:
            - string
            - 'null'
          description: Własny podpis użyty na pocztówce albo `null`.
          examples:
            - sig_ZeXOkSQjTp
        font_id:
          description: Pismo. Może być `null` tylko w szkicu.
          oneOf:
            - $ref: '#/components/schemas/FontId'
            - type: 'null'
        mistake:
          type: boolean
          description: >-
            Czy jedno słowo jest przekreślone i napisane ponownie, aby kartka
            wyglądała naturalnie.
        status:
          $ref: '#/components/schemas/PostcardStatus'
        submitted_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Moment złożenia zamówienia. `null`, dopóki pocztówka jest szkicem.
        sent_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Moment nadania pocztówki. `null`, dopóki status nie zmieni się na
            `sent`.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ValidationError:
      type: object
      required:
        - message
        - errors
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    Address:
      type: object
      required:
        - line_1
        - postal_code
        - country
        - city
      properties:
        line_1:
          type: string
          maxLength: 255
          description: Ulica i numer budynku.
          examples:
            - ul. Marszałkowska 10
        line_2:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Numer lokalu, piętro lub inna informacja.
          examples:
            - m. 4
        postal_code:
          type: string
          pattern: ^\d{2}-\d{3}$
          examples:
            - 00-001
        country:
          type: string
          enum:
            - PL
        city:
          type: string
          maxLength: 255
          examples:
            - Warszawa
    Recipient:
      type: object
      description: Podaj `first_name`, `company_name` albo oba pola.
      properties:
        prefix:
          type:
            - string
            - 'null'
          maxLength: 30
          examples:
            - Pani
        first_name:
          type:
            - string
            - 'null'
          maxLength: 255
        last_name:
          type:
            - string
            - 'null'
          maxLength: 255
        company_name:
          type:
            - string
            - 'null'
          maxLength: 255
    FontId:
      type: string
      enum:
        - font-1
        - font-2
      description: >-
        `font-1` to czytelne, zaokrąglone pismo (Standardowe). `font-2` to
        szybsze pismo łączone (Szybkie).
    PostcardStatus:
      type: string
      description: >-
        Etap realizacji pocztówki. Nieznane wartości traktuj jako „w
        realizacji”.
      enum:
        - draft
        - new
        - queued
        - rejected
        - pair_claimed
        - in_progress
        - pair_completed
        - sent
  responses:
    MissingIdempotencyKey:
      description: Brakuje nagłówka `Idempotency-Key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Idempotency-Key header is required to create or submit a postcard.
    Unauthorized:
      description: Brak klucza API albo klucz jest nieprawidłowy, unieważniony lub wygasł.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Unauthenticated.
    PaymentRequired:
      description: >-
        Konto ma mniej niż jeden kredyt. Saldo jest sprawdzane tylko w trybie
        live.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: You need at least 1 credit to create a postcard.
    Forbidden:
      description: >-
        Klucz API nie ma wymaganego uprawnienia albo zasób należy do kogoś
        innego.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: This action is unauthorized.
    NotFound:
      description: Zasób nie istnieje albo należy do drugiego trybu.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Not found.
    NotDraft:
      description: >-
        Pocztówka nie jest już szkicem albo `Idempotency-Key` został użyty z
        innym żądaniem.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: >-
              Postcard pc_MXP7a4Ni0c has already been submitted (status: new).
              Only drafts can be changed, submitted, or deleted.
    ValidationError:
      description: >-
        Pole jest nieprawidłowe, tekst nie mieści się na kartce lub kopercie
        albo `Idempotency-Key` jest dłuższy niż 255 znaków.
      content:
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/ValidationError'
              - $ref: '#/components/schemas/Error'
          examples:
            field:
              summary: Nieprawidłowe pole
              value:
                message: The selected font id is invalid.
                errors:
                  font_id:
                    - The selected font id is invalid.
            card_fit:
              summary: Wiadomość nie mieści się na kartce
              value:
                message: >-
                  The content does not fit on the postcard. Shorten it or remove
                  blank lines.
                errors:
                  content:
                    - >-
                      The content does not fit on the postcard. Shorten it or
                      remove blank lines.
            envelope_fit:
              summary: Adres nie mieści się na kopercie
              value:
                message: The sender or recipient address does not fit on the envelope.
                errors:
                  address:
                    - >-
                      The sender or recipient address does not fit on the
                      envelope.
            draft_limit:
              summary: Za dużo otwartych szkiców
              value:
                message: >-
                  You already have 100 open drafts. Submit or delete some of
                  them before saving another draft.
                errors:
                  draft:
                    - >-
                      You already have 100 open drafts. Submit or delete some of
                      them before saving another draft.
            signature_unavailable:
              summary: Własny podpis jest niedostępny
              value:
                message: >-
                  The selected signature is unavailable or is not active for
                  your plan.
                errors:
                  signature_id:
                    - >-
                      The selected signature is unavailable or is not active for
                      your plan.
    TooManyRequests:
      description: Przekroczono limit żądań. Odczekaj przed ponowieniem.
      headers:
        Retry-After:
          description: Liczba sekund, po której można ponowić żądanie.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Too Many Attempts.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Klucz API Paperjoy. Klucze z prefiksem `pj_test_` działają w trybie
        testowym, a z `pj_live_` w trybie live.

````

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