Authentication
To authenticate for the API, generate a JWT token depending on your environment and pass it in each request:
- SaaS
- Self-Managed
- Create client credentials by clicking Console > Organization > Administration API > Create new credentials.
- Add permissions to this client for Web Modeler API.
- After creating the client, you can download a shell script to obtain a token.
- When you run it, you will get something like the following:
{
"access_token": "eyJhbG...",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0
}
- Add an M2M application in Identity.
- Add permissions to this application for Web Modeler API.
- Generate a token to access the REST API. You will need the
client_id
andclient_secret
from the Identity application you created.curl --location --request POST 'http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<client id>' \
--data-urlencode 'client_secret=<client_secret>' \
--data-urlencode 'grant_type=client_credentials' - You will get something like the following:
{
"access_token": "eyJhbG...",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0
}
Example usage
Take the access_token value from the response object and store it as your token.
Send the token as an authorization header in each request. In this case, call the Web Modeler endpoint to validate the token.
To use the JWT token in the cloud, use the following command:
curl -o - 'https://modeler.camunda.io/api/v1/info' -H 'Authorization: Bearer eyJhb...'
When using a Self-Managed installation, you can use the following command instead:
curl -o - 'http://localhost:8070/api/v1/info' -H 'Authorization: Bearer eyJhb...'
You will get something like the following:
{
"version": "v1",
"authorizedOrganization": "12345678-ABCD-DCBA-ABCD-123456789ABC",
"createPermission": true,
"readPermission": true,
"updatePermission": true,
"deletePermission": false
}