Skip to Content

Authentication

One secret key per project, sent in the x-access-key header.

Your project key

Each project has one secret API key. Every request sends it in the x-access-key header. The examples in these docs read it from the POSTKEY_API_KEY environment variable.

curl https://api.postkey.dev/v1/health/auth \
  -H "x-access-key: $POSTKEY_API_KEY"

A 200 means the key is valid. A 401 means it's missing, wrong or was regenerated.

  • You see the full key once. After that the dashboard shows it masked.
  • Regenerate Key in the dashboard makes a new key. The old one stops working right away.
  • The key can do everything in the project. Keep it on your server. Never put it in a browser, a mobile app or a public repo.

One key for all your clients

There are no sub-keys. To keep clients apart, give each client a profile and connect their accounts into it. Every post names its accountId, so your own code decides who posts where.

Credits basics

Calls that do work on a network cost credits from your project's balance.

  • Publishing or scheduling to one platform costs 1 credit on most networks. X costs more, because X charges per post.
  • Drafts, reading your own data and failed calls cost nothing.
  • If one platform fails inside a post, its credits come back automatically.

Details in Credit usage.

Errors

Errors come back as JSON with a plain message:

401
{ "success": false, "message": "Invalid access key." }
StatusMeaning
400The request is invalid. The message says which field.
401Missing or invalid x-access-key.
402insufficient_credits: not enough credits. Nothing was sent. Add a credit pack or wait for the monthly reset.
403The feature isn't on your plan, or the account isn't in this project.
404Not found in this project.
429Too many requests. Wait and retry.

On this page