Skip to main content
Every API request sends an access token in the Authorization header:
Which way you get that token depends on who uses it:
Access tokens last a few minutes. Read how long from expires_in in the token response, and ask for a new one when it runs out or the API answers 401.

Personal API tokens

A personal API token lets your own scripts reach your account. Make one in Settings › API tokens.
1

Create a token

Click Create API token, give it a name and choose how long it works: 7, 30, 60 or 90 days, a year, or until you delete it. Keep Client ID and secret as the kind.
2

Copy the client ID and secret

The secret is shown once. Store it where your script can read it, never in code you share.
3

Get an access token

Your script exchanges the client ID and secret for an access token:
4

Call the API

Send the access token as a bearer token. When it expires, get a new one the same way.
Delete a token in the same settings page: scripts using it stop working at once.

Single tokens (old system)

Some tools only accept one fixed token. For those, choose Single token (old system) as the kind: you get one token to send as the bearer token as it is. It works for a year. You can create single tokens until 1 March 2027; after that, use a client ID and secret.

OAuth 2.0

For an app or service that other Plugchoice users sign in to. Email support@plugchoice.com for a client: tell us your app’s name and redirect URL, and which grant types you need. Plugchoice’s sign-in is OpenID Connect at accounts.plugchoice.com. Most OAuth and OpenID Connect libraries set themselves up from its discovery document:
Access tokens are JWTs and last a few minutes (expires_in). Send them to the API as they are.
Integrations made before this used https://app.plugchoice.com/oauth/authorize and https://app.plugchoice.com/oauth/token. Those addresses keep working for now with the same client ID and secret, but are being phased out: we email you the date. New integrations use the addresses above.

Authorization code flow

1

Send the user to sign in

The user signs in and approves your app. Check that state comes back unchanged. offline_access keeps the user signed in to your app for as long as you use the refresh token; leave it out and the sign-in ends with the user’s session.
2

Exchange the code for tokens

3

Call the API

Send the access_token as a bearer token. Store the refresh_token safely.
A mobile or desktop app can’t keep a secret. Ask for a client without one: it signs in with the code challenge alone (PKCE) and leaves out client_secret. Use a redirect URL with a path, such as myapp://oauth/callback.

Refreshing tokens

Before the access token expires, or when the API answers 401:
Every refresh returns a new refresh token: store it and use it next time. A refresh token from offline_access stops working after a year without use, and the user signs in again.

Client credentials flow

For your own server, without a user:
Reuse the access token until it expires, then ask for a new one the same way.

Device flow

For a device without a browser or keyboard, such as a display or a command-line tool. The device shows a code, and the user approves it on their phone or computer. Ask us to turn on the device flow for your client.
1

Ask for a code

2

Show the code

Show the user_code and tell the user to open the verification_uri, sign in and enter the code. Or show verification_uri_complete as a QR code: it has the code in it. Use the addresses from the answer, not fixed ones.
3

Wait for the approval

Ask for the token every interval seconds until the user approves:
Until then the answer is 400 with an error:Once approved, you get the same tokens as the authorization code flow.

Revoking access

Users see the apps they approved in Settings › Connected apps and can revoke them there. After that, your app’s tokens for that user stop working, and the user has to sign in again.
Keep your client secret on your server. Never put it in an app, in code that runs in the browser, or in a public repository.