To use the mabl API, you need to authenticate requests with an API key.
Creating API keys
Only workspace owners can create and view API keys:
- Go to Settings > APIs in the mabl app.
- Click on the + Create API key button.
- Select the appropriate type of API key.
- Give the API key a name.
- Click on the Save button.
API key types
Mabl offers different API key types with different levels of permissions. If you're getting started in the mabl API, these two key types are sufficient for most actions:
- Viewer - use for read-only activities, such as getting results from the reporting API.
- Editor - use for running tests and making changes to resources in your workspace.
Other key types available for the mabl API include:
- Deployment trigger - trigger deployment events and get results.
- Command line interface - complete any activity that is supported in the mabl CLI.
Authenticating requests
mabl API endpoints use basic auth to authenticate requests.
In cURL
In cURL, you can use the --user
or -u
flag to authorize a request using basic auth. The following sample cURL command shows how to pass the API key in a request with basic auth:
curl --request GET \
--url https://api.mabl.com/execution/result/event/{deployment-event-id} \
--user 'key:{your-api-key}'
When you send the request, cURL encodes authentication details in Base64 and adds an Authorization
header to the HTTP request:
curl --request GET \
--url https://api.mabl.com/execution/result/event/{deployment-event-id} \
--header 'authorization: Basic {your-api-key}'
In the interactive mabl API reference
If you are using the interactive API reference, you can authenticate your request by entering the following information in the Credentials panel:
- In the username field, input the word "key."
- In the password field, input the API key.
Use the language tabs to generate the request using a different scripting language.