Learn how to authenticate your access to the Katalon API.
Katalon API supports the following authentication types to ensure secure access to Katalon API. This guide outlines the available authentication mechanisms and provides examples for implementation.
Authentication Types
- HTTP Basic Authentication
- Katalon API Key
- JSON Web Token (JWT)
HTTP Basic Authentication
This method involves sending your Katalon username and password encoded in Base64 within the HTTP Authorization
header.
Implementation Steps
- Encode Credentials: Combine your username and password in the format
username:password
and encode this string using Base64. - Set Authorization Header: Include the encoded string in the
Authorization
header with the prefixBasic
.
Example Request
If your username is admin
and your password is admin
, the encoded string is YWRtaW46YWRtaW4
=.
cURL:
curl --location 'https://api.katalon.com/v1/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "email@katalon.com",
"password": "password"
}'
Note: Replace
123
with your actual test case ID.
Katalon API Key
For enhanced security and to avoid using your username and password directly, you can use a Katalon API Key.
Generate an API Key
The following steps are also documented in Katalon Docs: Generate Katalon API key.
- Log in to Katalon TestOps.
- Click on your avatar in the top right corner and select User Settings.
- Navigate to the Katalon API Key section.
- Click Create API Key, provide a name and expiration period, then click Create.
- Copy the generated API Key for use in your requests.
Implementation Steps
- Encode API Key: Encode your API Key in Base64 with a colon prefix, resulting in
:APIKEY
. - Set Authorization Header: Include the encoded string in the
Authorization
header with the prefixBasic
.
Example Request
If your API Key is APIKEY
, the encoded string is OkFQSUtFWQ==
.
curl --request GET \
--url https://testops.katalon.io/api/v1/test-cases/123 \
--header 'accept: */*' \
--header 'Authorization: Basic OkFQSUtFWQ=='
Note: Replace
123
with your actual test case ID.
JSON Web Token (JWT)
JWTs are typically obtained through an authentication process and are used to access protected resources.
Implementation Steps
- Login request: Send a
POST
request to the login endpoint with your email and password to receive a JWT token.
This request will return a JSON response containing the JWT token.curl --location 'https://api.katalon.com/v1/auth/login' \ --header 'Content-Type: application/json' \ --data-raw '{ "email": "email@katalon.com", "password": "password" }'
{ "data": { "jwt": "JWT_TOKEN", ... } }
Note: If not authorized, you will get a
401 Unauthorized
response. - Use the Token: Include the JWT token in the
Authorization
header with the prefixBearer
.curl --request GET \ --url https://api.katalon.com/v1/protected/resource \ --header 'Authorization: Bearer YOUR_JWT_TOKEN'
Note: Replace
YOUR_JWT_TOKEN
with the token received from the login response.