- 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. Generate an API Secret and 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.
Build the JWT payload
Set
iss to your API Secret ID and iat to the current Unix timestamp in seconds.Construct the signing secret
Concatenate your API Secret ID and API Secret Key with
|| between them.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:
Rotate an API Secret
The API settings page supports up to two API Secrets. Use the second slot to rotate without interrupting active traffic.Generate a second API Secret
Create a new API Secret in Settings > Integrations > API and store the new Secret ID and Secret Key securely.
Deploy the new secret
Update your server-side integration to sign JWTs with the new Secret ID and Secret Key.
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.