PopNowAPI Docs
Get started
Main content

Authentication

The key format, where to keep a key, per-key restrictions, rotation and what to do if a key leaks.

Authenticate API requests by sending an API key in the Authorization header:

Authorization: Bearer sk-popnow-3f9c0a…

Keys in the URL query string are not accepted. Your popnow.ai website login does not authenticate API requests.

The OpenAI-compatible routes under /v1 also accept the key in an x-api-key header. The native /api/v1 routes only read Authorization.

What a key looks like

A key is sk-popnow- followed by 48 lowercase hexadecimal characters. After the initial full-key display, the API console shows only the first few characters. If you lose the key, create a new one; the full value cannot be recovered.

Create a key

  1. Sign in at popnow.ai and open the API console.
  2. Choose Create key and give it a name that identifies its environment or service, such as production-backend.
  3. Copy the full key immediately. It is shown only once.

You can hold several keys at once — one per environment or per service is a good habit, because you can then revoke one without touching the others. All keys on an account spend from its PopNow balance, shown in USD. A new account starts at $0; add funds in API billing.

Where to keep it

  • In an environment variable or your platform's secret store (POPNOW_API_KEY), not in source code.
  • Never in a browser, a mobile app or any other code that runs on someone else's device. Anyone who can read the key can spend your balance. Put your own server in between and let it call PopNow.
  • Not in logs. If you log request headers, drop Authorization first.

Restrict what a key can do

Each key can carry its own limits, set in the API console:

RestrictionWhat it doesError when it blocks a request
Allowed modelsThe key can call only the models you list40301
IP allowlistRequests must come from these addresses or ranges40302
Spend capsDaily, monthly and lifetime USD limits: dailySpendCap, monthlySpendCap, totalSpendCap40202

By default a key has no restrictions and no caps. Give production keys the narrowest set that still works.

Tasks belong to the key that created them

recordInfo, retry, purge, the task list and usage are scoped to tasks created with the same key. Querying a task created with another key on your account returns 404, just like querying a task that does not exist. Tasks started on the website are not accessible through API keys. Use the API console for an account-wide view.

Rotation

To replace a key without downtime:

  1. Create the new key.
  2. Deploy it everywhere the old one was used.
  3. Check the console until the old key's last-used time stops updating.
  4. Revoke the old key.

If a key leaks

  1. Revoke it now in the API console. Revocation takes effect on the next request.
  2. Create a replacement and deploy it.
  3. Check what it was used for: the console's logs and usage show every task the key created.
  4. Tighten the replacement with an IP allowlist and a spend cap.

Contact support if you see spending you did not make.

What a failure looks like

All three authentication problems return HTTP 401 with code: 401; msg tells them apart:

msg saysWhat happenedWhat to do
Missing credentialsNo Authorization header arrivedCheck that the header is set and that the environment variable is loaded in the running process
API key format is not recognizedSomething arrived, but it is not a PopNow keyMake sure it starts with sk-popnow-; you may have pasted a different value
Credentials are invalid or expiredThe key does not exist, was revoked or has expiredCreate a new key instead of retrying with the invalid one

A valid key can still be refused with 403 — for example when the account's email address is not verified yet (40310). See Errors.

On this page