Skip to main content

Authenticate: Generate an Access Token

Exchange your Cuseum credentials for the OAuth access token used by every API call.

Every API call needs an access token. You get one by sending a POST request to the token endpoint. This request does not use a Bearer token.

The Request

POST https://app.cuseum.com/oauth/token

Send these as URL parameters. All are required:

Parameter

Description

Example

grant_type

Use password.

password

email

Email of the Cuseum user who is authenticating.

password

Password of that Cuseum user.

********

client_id

UID of the OAuth application.

<client-id>

client_secret

Secret of the OAuth application.

<client-secret>

scope

Space-separated scopes enabled for the integration.

public read_external_users read_pass_books

museum_id

ID of the museum the user belongs to.

<museum-id>

Replace every placeholder with a URL-encoded value (for example, @ becomes %40 and a space becomes %20).

cURL Example

curl --request POST \
  'https://app.cuseum.com/oauth/token?grant_type=password&email=user%40example.com&password=%3Cuser-password%3E&client_id=%3Cclient-id%3E&client_secret=%3Cclient-secret%3E&scope=public%20read_external_users%20read_pass_books&museum_id=%3Cmuseum-id%3E'

Using Postman or Another API Client

  1. Create a new request and set the method to POST.

  2. Set the URL to https://app.cuseum.com/oauth/token.

  3. Add the fields from the table above as URL parameters.

  4. Do not add a Bearer token.

  5. Send the request and save the returned access_token securely.

A Successful Response

{
  "access_token": "<access-token>",
  "refresh_token": "<refresh-token>",
  "token_type": "Bearer",
  "expires_in": 7200,
  "scope": "public read_external_users read_pass_books",
  "created_at": 1710000000
}

Treat token values as opaque. expires_in is the token lifetime in seconds (7200 in the reference example, which is two hours).

Use the Token

Add this header to every later request:

Authorization: Bearer <access-token>

When the token expires or stops working, request a new one. Reuse one token for many calls instead of requesting a token for every page.

If It Fails

See Handle Errors and Troubleshoot. For credentials or access questions, contact [email protected].

Did this answer your question?