Authentication¶
To call the Dune API you first need a JWT access token. Get one by authenticating with your Dune credentials against the credentials auth endpoint:
POST https://duneframework.com/api/auth/credentials
Content-Type: application/json
{
"UserName": "<your-email>",
"Password": "<your-password>"
}
Note
This only works for machine users. Social auth users (e.g. Microsoft identities) don't have a password — they authenticate through a browser-based OAuth flow instead and can't use this endpoint. Use a machine user for API/script access.
Machine users are created in the Dune portal under Settings > Users by a TenantAdmin — see Authorization.
On success, the response sets two cookies:
| Cookie | Contains | Purpose |
|---|---|---|
ss-tok |
JWT access token | Authenticates subsequent API requests |
ss-reftok |
Refresh token | Used to obtain a new access token once it expires |
Using the access token¶
Every API request needs a valid access token. You can provide it either way:
- Cookie — the
ss-tokcookie set by the login response is sent automatically by browsers and most HTTP clients on subsequent requests. - Authorization header — send the access token explicitly as a bearer token:
Tip
If you're already logged in to the Dune portal and just want to try something out via the API, you don't need to log in again: open your browser's dev tools, find the ss-tok cookie for your Dune instance, and use its value as the bearer token.
Don't forget the X-Tenant header described in Getting Started — it's required on every request in addition to authentication.