- API Secret JWT authentication. Recommended for new integrations. Generate a short-lived JWT from an API Secret ID and API Secret Key, then send the JWT as a Bearer token.
- Team API key authentication. Legacy authentication for existing integrations. API key authentication is planned for deprecation.
Create an API Secret
Log in to Heymarket and go to Settings > Integrations > API. Click Generate Secret. You can give the secret a name, such as the integration that will use it, so you can tell your secrets apart later. The name is optional and can be up to 64 characters. It cannot contain control characters or text-direction characters. Copy both values:- Secret ID: Used as the JWT
issvalue. - Secret Key: Used with the Secret ID to sign the JWT.
Generate a signed JWT
Use your API Secret ID and Secret Key to sign a short-lived JSON Web Token (JWT). Send the signed JWT as a Bearer token in theAuthorization header.
1
Build the JWT header
Use the
HS256 algorithm.2
Build the JWT payload
Set
iss to your API Secret ID and iat to the current Unix timestamp in seconds.3
Construct the signing secret
Concatenate your API Secret ID and API Secret Key with
|| between them.4
Sign and send the JWT
Sign the JWT with HMAC-SHA256 using the combined secret. Pass the resulting JWT as a Bearer token.
iat timestamp. Generate a new JWT per request, or cache it briefly for less than 5 minutes.
Python example
This example uses only the Python standard library.Check your credentials
UseGET /v1/inboxes as a low-risk check that your signed JWT works:
Manage API Secrets
A team can have up to six API Secrets. Give each integration its own secret, so you can revoke one integration’s access without affecting the others. Each secret on the API settings page shows its name, or Unnamed key, and when and by whom it was created.- Rename a secret. Click Rename next to the secret. Clear the name to remove it. Renaming does not change the Secret ID or Secret Key, so integrations that use the secret keep working.
- Revoke a secret. Click Revoke next to the secret and confirm. Revoking immediately breaks any integration that uses the secret, and cannot be undone.
Rotate an API Secret
Rotate a secret by running the new secret alongside the old one, so active traffic is not interrupted. If the team already has six secrets, revoke an unused one first.1
Generate a new API Secret
Create a new API Secret in Settings > Integrations > API, named so you can tell it from the old one, and store the new Secret ID and Secret Key securely.
2
Deploy the new secret
Update your server-side integration to sign JWTs with the new Secret ID and Secret Key.
3
Verify the new secret
Call
GET /v1/inboxes with a JWT signed by the new secret.4
Revoke the old secret
After the new secret is deployed and verified, revoke the old API Secret.
Legacy API key authentication
Existing integrations may still authenticate with a team API key while migration is planned.Request IDs
Every API response includes anX-Request-Id header. Record this value when you encounter an error. Heymarket support uses it to look up the specific request.