> ## 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.

# Lista kampanii

> Zwraca Twoje kampanie CSV z trybu klucza API, od najnowszych, po jednej stronie naraz, także niedokończone. Kampanie tworzysz w panelu, a API ich nie zmienia. Wymaga uprawnienia `campaigns:read`.



## OpenAPI

````yaml /openapi.yaml get /api/campaigns
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.
  - name: Wzory
    description: Przody kartek z nadrukiem, gotowe i własne.
  - name: Kampanie
    description: Kampanie CSV utworzone w panelu, tylko do odczytu.
paths:
  /api/campaigns:
    get:
      tags:
        - Kampanie
      summary: Lista kampanii
      description: >-
        Zwraca Twoje kampanie CSV z trybu klucza API, od najnowszych, po jednej
        stronie naraz, także niedokończone. Kampanie tworzysz w panelu, a API
        ich nie zmienia. Wymaga uprawnienia `campaigns:read`.
      operationId: listCampaigns
      parameters:
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PerPage'
        - $ref: '#/components/parameters/CampaignStatusFilter'
      responses:
        '200':
          description: Jedna strona kampanii z trybu klucza API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignList'
              example:
                data:
                  - id: cmp_4kQ9xW2mTb
                    test_mode: false
                    status: completed
                    file_name: klienci-wiosna.csv
                    message: >-
                      Dzień dobry {{imie}}!

                      Na wiosnę mamy dla Was 10% rabatu z kodem
                      {{kod_rabatowy}}.
                    font_id: font-1
                    mistake: true
                    signature: Marta z Kwiaciarni Pod Lipą
                    signature_id: null
                    counts:
                      rows: 12
                      invalid: 0
                      skipped: 1
                      postcards: 11
                    completed_at: '2026-11-17T15:02:00+00:00'
                    created_at: '2026-11-17T14:40:00+00:00'
                    updated_at: '2026-11-17T15:02:00+00:00'
                links:
                  first: https://paperjoy.co/api/campaigns?page=1
                  last: https://paperjoy.co/api/campaigns?page=1
                  prev: null
                  next: null
                meta:
                  current_page: 1
                  from: 1
                  last_page: 1
                  links:
                    - url: null
                      label: '&laquo; Previous'
                      page: null
                      active: false
                    - url: https://paperjoy.co/api/campaigns?page=1
                      label: '1'
                      page: 1
                      active: true
                    - url: null
                      label: Next &raquo;
                      page: null
                      active: false
                  path: https://paperjoy.co/api/campaigns
                  per_page: 50
                  to: 1
                  total: 1
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  parameters:
    Page:
      name: page
      in: query
      required: false
      description: Numer strony, od 1. Strona za końcem listy zwraca pustą tablicę `data`.
      schema:
        type: integer
        minimum: 1
        default: 1
    PerPage:
      name: per_page
      in: query
      required: false
      description: Liczba pocztówek na stronie.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 50
    CampaignStatusFilter:
      name: status
      in: query
      required: false
      description: Zwróć tylko kampanie w tym kroku, np. `completed`.
      schema:
        $ref: '#/components/schemas/CampaignStatus'
  schemas:
    CampaignList:
      type: object
      description: Jedna strona kampanii z linkami i metadanymi stronicowania Laravela.
      required:
        - data
        - links
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Campaign'
        links:
          $ref: '#/components/schemas/PaginationLinks'
        meta:
          $ref: '#/components/schemas/PaginationMeta'
    CampaignStatus:
      type: string
      description: >-
        Krok kampanii: `mapping` (mapowanie kolumn), `content` (treść kartki),
        `validation` (weryfikacja wierszy), `confirmation` (potwierdzenie) albo
        `completed` (pocztówki utworzone).
      enum:
        - mapping
        - content
        - validation
        - confirmation
        - completed
    Campaign:
      type: object
      description: >-
        Kampania CSV. Nie zawiera kolumn ani wierszy pliku, bo są w nich dane
        odbiorców.
      required:
        - id
        - test_mode
        - status
        - file_name
        - message
        - font_id
        - mistake
        - signature
        - signature_id
        - counts
        - completed_at
        - created_at
        - updated_at
      properties:
        id:
          type: string
          examples:
            - cmp_4kQ9xW2mTb
        test_mode:
          type: boolean
          description: >-
            `true` dla kampanii testowej. Jej pocztówki są darmowe i nigdy nie
            są pisane ani wysyłane.
        status:
          $ref: '#/components/schemas/CampaignStatus'
        file_name:
          type: string
          description: Nazwa wgranego pliku.
          examples:
            - klienci-wiosna.csv
        message:
          type:
            - string
            - 'null'
          description: >-
            Treść kartki ze zmiennymi, np. `{{imie}}`, wspólna dla całej
            kampanii. `null`, dopóki nie zapiszesz kroku treści.
        font_id:
          description: Pismo albo `null` przed zapisaniem kroku treści.
          oneOf:
            - $ref: '#/components/schemas/FontId'
            - type: 'null'
        mistake:
          type:
            - boolean
            - 'null'
          description: >-
            Czy kartki mają przekreślone słowo. `null` przed zapisaniem kroku
            treści.
        signature:
          type:
            - string
            - 'null'
          description: Wpisany podpis albo `null`.
        signature_id:
          type:
            - string
            - 'null'
          description: Własny podpis kampanii albo `null`.
          examples:
            - sig_ZeXOkSQjTp
        design_id:
          type:
            - string
            - 'null'
          description: Wzór przodu kampanii albo `null` dla czystego przodu.
          examples:
            - wz_7Hs1Qa
        counts:
          type: object
          description: Liczba wierszy pliku według stanu.
          required:
            - rows
            - invalid
            - skipped
            - postcards
          properties:
            rows:
              type: integer
              minimum: 0
              description: Wiersze z danymi w pliku.
            invalid:
              type: integer
              minimum: 0
              description: Wiersze, które czekają na poprawkę.
            skipped:
              type: integer
              minimum: 0
              description: Wiersze pominięte, z których nie powstanie kartka.
            postcards:
              type: integer
              minimum: 0
              description: >-
                Pocztówki utworzone przy potwierdzeniu. `0` przed
                potwierdzeniem.
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Moment potwierdzenia kampanii. `null`, dopóki status nie zmieni się
            na `completed`.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    PaginationLinks:
      type: object
      description: >-
        Adresy sąsiednich stron. `prev` i `next` mają wartość `null` na końcach
        listy.
      required:
        - first
        - last
        - prev
        - next
      properties:
        first:
          type: string
          format: uri
        last:
          type: string
          format: uri
        prev:
          type:
            - string
            - 'null'
          format: uri
        next:
          type:
            - string
            - 'null'
          format: uri
    PaginationMeta:
      type: object
      description: Położenie tej strony w całej liście.
      required:
        - current_page
        - from
        - last_page
        - links
        - path
        - per_page
        - to
        - total
      properties:
        current_page:
          type: integer
          minimum: 1
        from:
          type:
            - integer
            - 'null'
          description: >-
            Pozycja pierwszego elementu na tej stronie albo `null`, gdy strona
            jest pusta.
        last_page:
          type: integer
          minimum: 1
        links:
          type: array
          description: >-
            Linki do budowy paginacji: poprzednia strona, kolejne numery stron,
            następna strona.
          items:
            type: object
            required:
              - url
              - label
              - page
              - active
            properties:
              url:
                type:
                  - string
                  - 'null'
                format: uri
              label:
                type: string
              page:
                type:
                  - integer
                  - 'null'
              active:
                type: boolean
        path:
          type: string
          format: uri
          description: Adres listy bez parametrów zapytania.
        per_page:
          type: integer
          minimum: 1
          maximum: 100
        to:
          type:
            - integer
            - 'null'
          description: >-
            Pozycja ostatniego elementu na tej stronie albo `null`, gdy strona
            jest pusta.
        total:
          type: integer
          minimum: 0
          description: Liczba elementów listy w trybie klucza API.
    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
    FontId:
      type: string
      enum:
        - font-1
        - font-2
      description: >-
        `font-1` to czytelne, zaokrąglone pismo (Standardowe). `font-2` to
        szybsze pismo łączone (Szybkie).
  responses:
    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.
    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.
    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.
  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.