Address and key
Callhttps://api.pincast.fm/v1 with your key in the X-Pincast-Key header:
pck_, your app id, _, then a secret of 20 or more characters, each a letter, a digit, _ or -. Keep it on your server: never in a web page, an app bundle or a query string. Placecard stores only its sha256.
Pincast issues keys by hand. To ask for one, write to andrew@pincast.fm.
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.
The older address, https://www.pincaster.com/api/placecard/v1, and the header’s older name, X-Placecard-Key, keep working, with the same calls and the same answers. Use api.pincast.fm for new work.
The calls
Order of checks
Every call that takes a key runs its checks in this order and answers with the first one that fails:- The key: 400 when
X-Pincast-KeyandX-Placecard-Keyboth come and differ, 401 without one, 403 for a wrong, revoked, expired or disabled one. - Your key’s limit: 429.
- The set id: 400.
- The
Idempotency-Key, when one is sent: 400. - The body: 400.
- For a collect for a signed in person, and for a claim, that person’s sign-in link: 403.
Retries
Every call is safe to send again. For the three writes (PUT a set, POST a collect, POST a claim) you can also send anIdempotency-Key header: a string your app makes for one request, such as a UUID, sent again unchanged with each retry of that request.
Placecard keeps the first 200 answer to that key for 24 hours, for your app only, and answers a retry with it, marked Idempotent-Replayed: true, without running the call again. The same key with a different request answers 422. A refused call keeps nothing, so its retry runs again.
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 aRetry-After header, the seconds to wait. A refused call doesn’t count, so the call sent after the wait goes through.
Sign-in
When a person signs in to your app through id.pincast.fm, send their ID token toPOST /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 set to logto) and claims for that person, and for nobody who hasn’t signed in to your app: those calls answer 403.
Guest collects need no link. 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. Pincast adds your app’s id.pincast.fm application id when it issues your key, so tokens made for your app pass the check.