Get your API tokens
To interact with MARCO APIs, you will need three API tokens:
- An application token
- A service account token
- An access token
This guide will show you how to obtain these tokens.
Prerequisites
To complete this guide, you will need a MARCO account. If you don't have one, see Create an account.
1. Create an application token
To obtain an application token, you need to register a MARCO application. We refer to these applications as "marpps" and we use them to represent ledger-agnostic applications.
To create a marpp:
On MARCO Console, go to Marpps > Register Application:
Set a name for the application.
Click Register Application.
Copy and save the Application ID and Application Token.
The application ID and token will be used to refer to your application in API requests.
2. Create a service account token
Next, you will register a service account to identify your computer as an authorized user in API requests.
To create a service account:
On MARCO Console, go to Service Accounts > Register Account:
Set a name for the account.
Click Register Service Account.
dangerIt's crucial to keep service account credentials secret. Sharing these credentials can compromise the account and associated resources. If you suspect that a service account has been compromised, you can disable it and create a new one in the Service Accounts section of the MARCO Console.
Copy and save the new account's Email:
Open the Service Account API Keys tab.
Click Generate API Key.
Copy and save the Service Account API Token:
3. Create an access token
Finally, you will create an access token that is derived from your service account API key. Most API calls request to provide both the access token and the application token.
To get an access token:
In the command line, run the following command, replacing
APPLICATION_ID
,APPLICATION_TOKEN
,SERVICE_ACCOUNT_TOKEN
andSERVICE_ACCOUNT_EMAIL
with your credentials from the previous steps:curl --location --request POST 'https://api-marco.finboot.com/auth/accessToken?clientId=<APPLICATION_ID>' \
--header 'ApplicationToken: <APPLICATION_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"credentials": "{\"apiToken\":\"<SERVICE_ACCOUNT_TOKEN>\",\"status\":\"\"}",
"identity": {
"id": 0,
"identifier": "<SERVICE_ACCOUNT_EMAIL>",
"marcoId": "",
"status": "",
"type": "USER",
"dateCreated": 0,
"identityProfile": {
"displayName": ""
}
},
"params": {
"authType": "apiToken"
}
}'Copy and save the resulting token. If you get any errors, see the API Reference for this endpoint.
noteUnlike the application and service account tokens, the access token expires after 30 days. Remember to generate a new access token every time it expires to keep using the API.
Next steps
Now that you have your tokens, let's setup your environment and make your first API call.