Quickstart

From token to your first key in four steps.

Create a token

In the panel, under API β€Ί Tokens, create a token with the permissions your system needs. Copy it right away: it is shown only once.

On the same screen, the usage example shows the API address. Copy it too.

Keep the token on the server

Put the address and the token in environment variables on the server that will call the API:

export PROJECT_API_URL="paste the address from the panel here"
export PROJECT_TOKEN="prj_live_..."

Never put the token in a website, an app or a program that runs on the customer's computer: anyone could read the token and spend your balance.

Test with /me

If it returns your account and the token permissions, everything is set:

curl -sS "$PROJECT_API_URL/me" \
  -H "Authorization: Bearer $PROJECT_TOKEN" \
  -H "Accept: application/json"

Generate your first key

Take a product_id from List products and generate a key:

curl -sS -X POST "$PROJECT_API_URL/keys" \
  -H "Authorization: Bearer $PROJECT_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 3f1c9e2a-7b4d-4c1e-9a0f-5d2b8c6e1a47" \
  -d '{"product_id":1001,"quantity":1,"days":30}'

The Idempotency-Key header is what prevents a double charge if the connection drops. Understand idempotency.

What next?

On this page