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

# Record that a person collected a card

> Send the card's key, or the whole card to register or update it first. The actor is the person as your app knows them: a Logto id once they have signed in and your app has sent their sign-in token with POST /people, or your app's guest token for this device before that. The card's parent (a tree card's species card) is held through it and recorded with it.

Safe to send again until you hear back: a collect with the same card, actor and time changes nothing and answers as the first send did, first included. A later time counts one more collect; an earlier time moves the first collect back. A collect sent without at takes Placecard's clock, so each send of it is a new time: send it with an Idempotency-Key to retry it safely.



## OpenAPI

````yaml /api-reference/openapi.json post /sets/{set}/collects
openapi: 3.1.0
info:
  title: Placecard registry
  version: 1.0.0
  summary: Register your app's cards with Placecard and record what people collect.
  description: >-
    Seven calls. Six go from your server with your app key: register a card set
    and its cards, record a collect, read what one person holds, link a person
    when they sign in to your app, move a guest's cards to them, and read a set
    back. The seventh, the list of apps on Pincast, is public and needs no key.


    Addresses: call https://api.pincast.fm/v1 with your key in the X-Pincast-Key
    header. The older address, https://www.pincaster.com/api/placecard/v1, and
    the header's older name, X-Placecard-Key, keep working: the same calls and
    the same answers, except that a key error at the older address names
    X-Placecard-Key.


    Checks run in this order on every call that takes a key: the key first (400
    when X-Pincast-Key and X-Placecard-Key both come and differ, 401 without
    one, 403 for a wrong, revoked, expired or disabled one), then your key's
    limit (429), then the set id (400), then the Idempotency-Key when one is
    sent (400), then the body (400), then, for a collect for a signed in person
    and for a claim, that person's sign-in link (403). Every error answers with
    the same JSON body: see the Error schema. On a 4xx its data says what to do:
    a code to branch on, the field at fault when there is one, and a fix in one
    sentence.


    Retries: every call is safe to send again, and each write says how. For the
    three writes (PUT a set, POST a collect, POST a claim) you can also send an
    Idempotency-Key header: Placecard keeps the first 200 answer to that key for
    24 hours and answers a retry with it, marked Idempotent-Replayed: true,
    without running the call again.


    Sign-in: when a person signs in to your app through id.pincast.fm, send
    their ID token to POST /people once. Placecard checks it with id.pincast.fm
    and links the person to your app. From then on your key can record collects
    (actor.source logto) and claims (to) for that person, and for nobody who has
    not signed in to your app: those calls answer 403. Guest collects need no
    link, and a guest token is never a person's id: a guest collect for an id
    that holds cards in your app as a signed-in person answers 409. Placecard
    reads only the token's issuer, subject, audience and times, and keeps none
    of the person's profile.


    Limits: each key takes 600 calls a minute, counted over the last 60 seconds,
    unless Pincast gave it a limit of its own. Past it, a call answers 429 with
    a Retry-After header, the seconds to wait. A refused call does not count, so
    the call sent after the wait goes through. Placecard logs each call made
    with your key (its time, method, path without the query string, key and
    answer, never the body) and keeps the log 90 days. The list of apps has no
    limit of its own and logs nothing: its answer is the same for everyone, and
    the edge keeps it 5 minutes.


    This file describes the registry as it runs today. The tests in
    tests/placecardApiV1.test.js send every example here to the real handlers
    and fail when an answer and this file disagree.
servers:
  - url: https://api.pincast.fm/v1
    description: >-
      Production: the Pincast address for the card registry. Send your key in
      X-Pincast-Key.
  - url: https://www.pincaster.com/api/placecard/v1
    description: >-
      Production, the older address, kept working: the same calls and answers,
      and a key error here names X-Placecard-Key. Use api.pincast.fm for new
      work.
security:
  - pincastKey: []
tags:
  - name: Sets
    description: Card sets and their cards.
  - name: Collects
    description: What people collect, and what they hold.
  - name: Claims
    description: A guest's cards, moved to them when they sign in.
  - name: People
    description: The people who signed in to your app.
  - name: Apps
    description: The apps listed on Pincast.
paths:
  /sets/{set}/collects:
    parameters:
      - $ref: '#/components/parameters/Set'
    post:
      tags:
        - Collects
      summary: Record that a person collected a card
      description: >-
        Send the card's key, or the whole card to register or update it first.
        The actor is the person as your app knows them: a Logto id once they
        have signed in and your app has sent their sign-in token with POST
        /people, or your app's guest token for this device before that. The
        card's parent (a tree card's species card) is held through it and
        recorded with it.


        Safe to send again until you hear back: a collect with the same card,
        actor and time changes nothing and answers as the first send did, first
        included. A later time counts one more collect; an earlier time moves
        the first collect back. A collect sent without at takes Placecard's
        clock, so each send of it is a new time: send it with an Idempotency-Key
        to retry it safely.
      operationId: postCollect
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectRequest'
            examples:
              story:
                summary: A guest collects the tree card at the tree
                value:
                  card: tree:2614648
                  actor:
                    id: guest-7f3c9a2e5b41
                    source: anonymous
                  at: '2026-11-14T15:04:05Z'
                  lat: 40.77951
                  lng: -73.96311
                  accuracy: 8
      responses:
        '200':
          description: >-
            The collect is recorded. first is true when this collect's time is
            this person's first hold of the card: on their first collect, on a
            resend of it, and on a collect dated before their first. count is
            how many times they collected it directly.
          headers:
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectResponse'
              examples:
                story:
                  value:
                    collected: true
                    first: true
                    count: 1
                    collectedAt: '2026-11-14T15:04:05.000Z'
                    card:
                      key: tree:2614648
                      type: tree
                    parent:
                      key: species:ginkgo
                      first: true
        '400':
          description: >-
            The set id or the body breaks a rule. Messages: Invalid set id;
            Invalid Idempotency-Key; JSON body required; actor required;
            actor.id required; actor.source is logto or anonymous; at must be an
            ISO time, not in the future; lat and lng go together, as numbers;
            accuracy must be metres; card required (a key, or a card); card:
            followed by the card's rule, when a whole card is sent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/KeyMissing'
        '403':
          $ref: '#/components/responses/WriteRefused'
        '404':
          description: >-
            The set or the card is not registered. Messages: Set <id> is not
            registered; Card <key> is not registered.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The card is retired and takes no new collects. People who hold it
            keep it. Message: Card <key> is retired. Or the collect is a guest's
            (actor.source anonymous) for an id that holds cards in your app as a
            signed-in person: a guest write never lands on a person's cards.
            Message: Actor holds cards as a signed-in person.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/RateLimited'
        default:
          $ref: '#/components/responses/ServerError'
      security:
        - pincastKey: []
components:
  parameters:
    Set:
      name: set
      in: path
      required: true
      description: Your set's id, chosen by your app.
      schema:
        $ref: '#/components/schemas/SetId'
      examples:
        story:
          value: central-park-trees
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Optional, on the three writes. A string your app makes for one request,
        a UUID for example, and sends again unchanged with each retry of that
        request. Placecard keeps the first 200 answer to it for 24 hours, for
        your app only. A retry with the same key and the same request (method,
        path and body; the order of keys in the body does not matter) answers
        that answer again, marked Idempotent-Replayed: true, and runs nothing.
        The same key with a different request answers 422. A refused call keeps
        nothing, so its retry runs again.
      schema:
        type: string
        pattern: ^[\x21-\x7E]{1,255}$
        description: 1 to 255 visible ASCII characters, with no spaces.
      examples:
        retry:
          value: 5f0c2a9e-7d41-4b8e-a3c6-1e9d2b7f4a60
  schemas:
    CollectRequest:
      type: object
      required:
        - card
        - actor
      additionalProperties: false
      dependentRequired:
        lat:
          - lng
        lng:
          - lat
      properties:
        card:
          description: The card's key, or the whole card to register or update it first.
          oneOf:
            - $ref: '#/components/schemas/CardKey'
            - $ref: '#/components/schemas/Card'
        actor:
          $ref: '#/components/schemas/Actor'
        at:
          $ref: '#/components/schemas/Time'
          description: >-
            When it was collected, on your app's clock. Not more than five
            minutes ahead of Placecard's clock, and not before 2015. Leave it
            out for now.
        lat:
          type: number
          minimum: -90
          maximum: 90
          description: Where it was collected. Sent with lng.
        lng:
          type: number
          minimum: -180
          maximum: 180
          description: Sent with lat.
        accuracy:
          type: number
          minimum: 0
          description: How sure the place is, in metres.
    CollectResponse:
      type: object
      required:
        - collected
        - first
        - count
        - collectedAt
        - card
        - parent
      additionalProperties: false
      properties:
        collected:
          const: true
        first:
          type: boolean
          description: >-
            True when this collect's time is this person's first hold of the
            card, so a resend answers as the first send did.
        count:
          type: integer
          minimum: 1
          description: How many times this person collected the card directly.
        collectedAt:
          $ref: '#/components/schemas/Time'
          description: This person's first collect of the card.
        card:
          type: object
          required:
            - key
            - type
          additionalProperties: false
          properties:
            key:
              $ref: '#/components/schemas/CardKey'
            type:
              $ref: '#/components/schemas/CardType'
        parent:
          type:
            - object
            - 'null'
          description: The parent card, held through this one; null when the card has none.
          required:
            - key
            - first
          additionalProperties: false
          properties:
            key:
              $ref: '#/components/schemas/CardKey'
            first:
              type: boolean
              description: >-
                True when this collect is this person's first hold of the
                parent: its time is their first hold of the parent, and through
                this card.
    Error:
      type: object
      description: >-
        The body of every error. message says what was wrong, for a person to
        read; statusCode repeats the HTTP status; data, on every 4xx and on a
        503, says what to do.
      required:
        - url
        - statusCode
        - statusMessage
        - message
      additionalProperties: false
      properties:
        url:
          type: string
          description: The path that was called.
        statusCode:
          type: integer
          minimum: 400
          maximum: 599
        statusMessage:
          type: string
          description: Empty, or Not Found on a 404.
        message:
          type: string
        stack:
          type: string
          description: Always empty in production.
        data:
          $ref: '#/components/schemas/ErrorData'
    SetId:
      type: string
      description: >-
        Lowercase letters, digits, underscores and hyphens, starting with a
        letter or digit, 64 characters at most.
      pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
    CardKey:
      type: string
      description: >-
        Your app's own id for the card, unique in the set: letters, digits and :
        _ . or hyphen, starting with a letter or digit, 128 characters at most.
      pattern: ^[A-Za-z0-9][A-Za-z0-9:_.-]{0,127}$
    Card:
      type: object
      description: >-
        One card as your app sends it. An empty string or null counts as left
        out. The server ignores fields not listed here.
      required:
        - key
        - type
        - title
      additionalProperties: false
      dependentRequired:
        lat:
          - lng
        lng:
          - lat
      properties:
        key:
          $ref: '#/components/schemas/CardKey'
        type:
          $ref: '#/components/schemas/CardType'
        parent:
          $ref: '#/components/schemas/CardKey'
          description: >-
            The key of the card this one belongs to (a tree card's species
            card). It must be in the same call or already registered, and is
            never the card itself.
        title:
          type: string
          minLength: 1
          maxLength: 200
        subtitle:
          type: string
          maxLength: 200
        fact:
          type: string
          maxLength: 300
        rarity:
          type: string
          maxLength: 32
          description: Your app's own word, printed as given.
        foil:
          type: boolean
          description: Only true makes a foil card.
        image:
          type: object
          additionalProperties: false
          properties:
            url:
              type: string
              maxLength: 1000
              pattern: ^https?://
            credit:
              type: string
              maxLength: 300
            license:
              type: string
              maxLength: 100
        url:
          type: string
          maxLength: 1000
          pattern: ^https?://
          description: Where your app plays this card.
        lat:
          type: number
          minimum: -90
          maximum: 90
          description: Sent with lng. A numeric string is also accepted.
        lng:
          type: number
          minimum: -180
          maximum: 180
          description: Sent with lat. A numeric string is also accepted.
        data:
          type: object
          description: Anything else your card's face needs, under 8000 characters as JSON.
        status:
          type: string
          enum:
            - active
            - retired
          default: active
          description: >-
            A retired card stays with the people who hold it and takes no new
            collects.
    Actor:
      type: object
      required:
        - id
        - source
      additionalProperties: false
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 255
          description: >-
            A Logto id, or your app's guest token for this device. Trimmed
            before the check.
        source:
          type: string
          enum:
            - logto
            - anonymous
          description: >-
            logto for a signed in person, once your app has sent their sign-in
            token with POST /people; anonymous for a guest token, never a
            person's id (409 actor_signed_in for an id that holds cards in your
            app as a signed-in person).
    Time:
      type: string
      format: date-time
      description: An ISO 8601 time.
    CardType:
      type: string
      description: >-
        Your app's own word for the kind of card (species, tree): a lowercase
        word of 32 characters at most.
      pattern: ^[a-z][a-z0-9_-]{0,31}$
    ErrorData:
      type: object
      description: >-
        What to do about a 4xx or a 503. Branch on code: it stays the same from
        release to release, while message and fix are for people and may be
        worded better later.
      required:
        - code
        - fix
      additionalProperties: false
      properties:
        code:
          type: string
          enum:
            - key_missing
            - key_invalid
            - key_expired
            - key_conflict
            - rate_limited
            - set_id_invalid
            - idempotency_key_invalid
            - body_not_json
            - field_required
            - field_invalid
            - too_many_cards
            - duplicate_card_key
            - parent_not_registered
            - too_many_actors
            - same_player
            - set_not_registered
            - card_not_registered
            - card_retired
            - actor_signed_in
            - idempotency_key_reused
            - token_invalid
            - token_expired
            - token_other_app
            - person_not_signed_in
            - signin_check_unavailable
          description: >-
            Each code with the status it comes with: key_missing 401,
            key_invalid 403, key_expired 403, key_conflict 400, rate_limited
            429, set_id_invalid 400, idempotency_key_invalid 400, body_not_json
            400, field_required 400, field_invalid 400, too_many_cards 400,
            duplicate_card_key 400, parent_not_registered 400, too_many_actors
            400, same_player 400, set_not_registered 404, card_not_registered
            404, card_retired 409, actor_signed_in 409, idempotency_key_reused
            422, token_invalid 400, token_expired 400, token_other_app 403,
            person_not_signed_in 403, signin_check_unavailable 503.
            field_required is a field left out or blank; field_invalid is one
            sent with the wrong type, shape, length or range. key_conflict is a
            call that sent X-Pincast-Key and X-Placecard-Key with different
            keys.
        field:
          type: string
          description: >-
            Where the fault is: a body field's path (name, meta.checkout,
            cards[3].key, card.title, actor.id, to, token), the set path
            parameter (set), the actor query parameter (actor), or a header
            (X-Pincast-Key at api.pincast.fm, X-Placecard-Key at the older
            address, Idempotency-Key). Left out when no one field is at fault.
        fix:
          type: string
          minLength: 1
          description: What to send instead, in one sentence.
  headers:
    IdempotentReplayed:
      description: >-
        true when this answer is the kept answer to your Idempotency-Key, given
        again. Not sent otherwise.
      schema:
        type: string
        const: 'true'
    RetryAfter:
      description: The seconds to wait before you send the call again, from 1 to 60.
      schema:
        type: integer
        minimum: 1
        maximum: 60
  responses:
    KeyMissing:
      description: >-
        No key was sent. Message: X-Pincast-Key required (X-Placecard-Key
        required at the older address).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    WriteRefused:
      description: >-
        The key is refused, or the person is not signed in to your app. Message:
        Invalid key, when it has the wrong shape, is unknown, was revoked or
        belongs to a disabled app. Message: Key expired, when it is past its
        expiry: use your app's newer key. Message: Person not signed in to this
        app, when the call is for a signed in person your app has not sent a
        sign-in token for: send it with POST /people, then send this call again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    IdempotencyKeyReused:
      description: >-
        Your app already used this Idempotency-Key, in the last 24 hours, for a
        different request. Message: Idempotency-Key already used for a different
        request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        Your key made as many calls in the last 60 seconds as its limit allows:
        600 unless Pincast gave it a limit of its own. Message: Too many
        requests. Wait the seconds in Retry-After, then send the call again; a
        refused call does not count.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: >-
        Something failed on Placecard's side. Message: internal server error.
        Safe to send the same call again later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    pincastKey:
      type: apiKey
      in: header
      name: X-Pincast-Key
      description: >-
        Your app's key, sent on every call from your server only. It reads pck_,
        your app id, an underscore, then a secret of 20 or more letters, digits,
        underscores or hyphens. Never put it in a web page, an app bundle or a
        query string. Placecard stores only its sha256.


        Your app can hold two live keys at once, so a key is replaced with no
        outage: the new key works at once, and the old one keeps working until
        its expiry (seven days after the new key is made, unless you ask for
        less). A revoked key is refused from the next call.


        X-Placecard-Key, the older name of this header, is taken too, at either
        address. Send one of the two; if both come and they differ, the call
        answers 400 key_conflict.

````

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