Authentication
Obtaining the Access Token
To begin, you must exchange your client credentials (client_id and client_secret), provided by Numberly, for an access_token.
Technical Definition
- HTTP Method:
POST - Endpoint:
{subdomain}.api.numberly.com/v1/oauth2/token - Content-Type:
application/x-www-form-urlencoded
Request Body Parameters
| Parameter | Required | Value / Description |
|---|---|---|
grant_type | Yes | Must be set to client_credentials. |
client_id | Yes | Your client identifier (e.g., nmp_client_foo). |
client_secret | Yes | Your client secret (e.g., tDDyv8oLVbbPnJ7...). |
Request Example
curl -X POST "https://{subdomain}.api.numberly.com/v1/oauth2/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=VOTRE_CLIENT_ID" \
-d "client_secret=VOTRE_CLIENT_SECRET"
Response (Success)
The API returns a JSON object containing the token and its validity duration (default 1 hour / 3600 seconds).
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
Using the Token
Once the token is obtained, you must include it in the HTTP Authorization header of all your subsequent API requests. The token type is Bearer.
Header Format:Authorization: Bearer <your_access_token>
Authenticated Call Example
curl -X GET "https://{subdomain}.api.numberly.com/v1/campaigns" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json"
If the token is invalid or expired, the API will return an HTTP 401 Unauthorized error.
Authentication Error Management
When requesting a token, you may encounter specific errors (HTTP 400 or 401). The response body will contain a standardized error code.
Error Code (error) | Meaning | Corrective Action |
|---|---|---|
invalid_client | Client authentication failed (wrong ID or secret). | Check your credentials. |
invalid_request | Missing or malformed parameter. | Verify that grant_type is present. |
unsupported_grant_type | Unsupported grant type. | Ensure you are sending client_credentials. |
Error Response Example:
{
"error": "invalid_client",
"error_description": "Could not authenticate the client: unknown client_id"
}
Token Revocation
If necessary (for example, in case of compromise), you can invalidate an active token via the revocation endpoint.
- Endpoint:
POST {subdomain}.api.numberly.com/v1/oauth2/revoke - Parameters:
client_id,client_secret, andtoken(the token to revoke).
NMP: a how-to guide
Discover the power of the Numberly Martech Platform in action. This short video introduces the interface's usability and shows you how to create, target, and orchestrate your campaigns in just a few clicks.
How to use our API Reference
The Numberly Martech Platform API is designed to be powerful and flexible. To help you integrate it as quickly as possible, we have provided an interactive API Reference. This page is not just a list of endpoints: it is a hands-on playground where you can test, debug, and generate code in real time. Here is how to get the most out of it.