[Upcoming Deprecation] Management API Usage
Management API Tokens will be deprecated on May 31st 2025. Please consult version 1.1 of our public documentation on "API and SSO Credential Management" to read more about our latest recommendations for Management API authentication.
If you have any question or concern regarding this change, please reach out to your Moloco representative to hear more detailed about the transition plan.
The MCM Management API is a tool suite used to manage various aspects of your platform, including, ad account and campaign management, ad spend controls, and reporting. Please review follow the steps to generate an authentication token.
Prerequisites
In order to use the Management API you will need the following:
- A user on your platform with the Platform Owner role.
- The selected user’s email address and password.
Generating a token
Management API Tokens have been deprecated, please see the updated Management API documentation page for Management API Key requirements.
- Generate a short-lived JWT token using the CreateToken API, set
auth_type
tocredential
and provide a username and password for a user that has the platform owner role. - Store the token in a secure location with the expiration timestamp.
Example request:
curl --request POST \
--url https://<platform_name>-mgmt.mcm-api.moloco.com/rmp/mgmt/v1/platforms/<platform_id>/tokens \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"auth_type": "CREDENTIAL",
"credential_type_payload": {
"email": "[email protected]",
"password": "password"
}
}
'
Example response:
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJtb3JzZSIsImV4cCI6MTcyMzY2MTcwMCwiaWF0IjoxNzIzNjU4MTAwLCJ2ZXJzaW9uIjoidjIiLCJ1c2VyX2lkIjoickdrWE5ZVW1McnBHbEtBVHppVFgiLCJ1c2VyX2VtYWlsIjoiZXJpYy5za2liYUBtb2xvY28uY29tIiwidXNlcl90eXBlIjoiaW5kaXZpZHVhbCIsInBsYXRmb3JtX2lkIjoiTU9MT0NPX1NIT1BfREVNTyIsInVzZXJzcGFjZV9pZCI6IlVTRVJTUEFDRV9NT0xPQ09fU0hPUF9ERU1PIiwibmFtZSI6IkVyaWMgU2tpYmEgKEJEKSIsImxhc3RfbmFtZSI6IiIsInNjb3BlIjoiIiwidG9rZW5faWQiOiIiLCJmaWEiOjB9.n_Ste4tTZiW3eNV4kY1WtCGmYJiohcRQVJwseks-P4g", "expires_at":"2024-00-00T00:00:00Z", "user":{"id":"<user_name>", "email":"[email protected]", "name":"<name>", "roles":[{"name":"PLATFORM_OWNER", "resource_type":"PLATFORM", "resource_id":"ABC123"}, {"name":"PLATFORM_USER", "resource_type":"PLATFORM", "resource_id":"ABC123"}],
"status":"REGISTERED", "created_at":"2023-09-18T20:39:36Z", "updated_at":"2023-09-18T20:40:22Z"}}
Using the token
- Use the token in the
authorization header
usingBearer <token>
to make management API calls.
Example using the report API with a token:
curl --request POST \
--url https://<platform_name>-mgmt.mcm-api.moloco.com/rmp/mgmt/v1/platforms/<platform_id>/report \
--header 'Authorization: Bearer <token_from_response>' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"date_start": "2024-07-01",
"date_end": "2024-08-01",
"group_by": [
"AD_ACCOUNT"
]
}
'
- The token is valid for 1 hour; reuse the token to perform campaign management operations.
- Generate a new token with the existing token using
"auth_type": "TOKEN"
before the token expires. If the existing token is expired, generate a new token with"auth_type": "CREDENTIAL"
again.
Example using an existing token to request a new token
curl --request POST \
--url https://<platform_name>-mgmt.mcm-api.moloco.com/rmp/mgmt/v1/platforms/<platform_id>/tokens \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"auth_type": "TOKEN",
"token_type_payload": {
"token": "<token>"
}
}
'
Updated 3 months ago