API Authentication

To use Testmo's API, either directly or via our CLI tool, you need to generate an API key. This page explains how to generate API keys for your Testmo user and how to use them.

Generating API keys

To generate API keys in Testmo, simply visit your User Profile page (from the avatar image in the top right corner). Then click the change link next to the API access section to add one or more API keys. The API key is only displayed once when you generate the key, so make sure to store the key.

You can create multiple API keys and assign a name to each API key so you can remember where it's used and revoke keys once they are no longer in use.

Using API users and host/service accounts

You can use Testmo's API with any edition and subscription by creating API keys for individual users (see above). If you are using a Business or Enterprise subscription, you have the additional option to create separate API users on Admin > Users & roles.

API users are not counted towards the subscription user limit and are a great option to create separate users for certain hosts, services or integrations and assign custom roles and permissions. Once you create API users in the admin area, you can also manage the API keys for the users there.

API authentication

If you are directly accessing Testmo's API (instead of using our CLI tool, which is usually recommended), you need to send the generated API key as part of the HTTP request.

Testmo uses simple Bearer tokens to authenticate against the API. When calling the API, you just need to submit the token as part of an Authorization HTTP header like this:

Authorization: Bearer $TESTMO_TOKEN

You can generate and use multiple API tokens for each user account and delete API tokens when not in use anymore. It is recommended to generate a separate API token for each application, service or host you use so you can easily revoke individual API keys without affecting other services.

Here is a full example on how to authenticate against and call the Testmo API to retrieve basic information about the authenticated user:

$ TESTMO_TOKEN=********
$ curl -H "Authorization: Bearer $TESTMO_TOKEN" \
    https://<your-name>.testmo.net/api/v1/user

Last updated