Management API usage
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.
Note
Please contact your MCM team for assistance with the initial platform owner user creation.
Generating a token
- 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 21 days ago