Authentication

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

  1. HTTP Basic Authentication
  2. Katalon API Key
  3. 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

  1. Encode Credentials: Combine your username and password in the format username:password and encode this string using Base64.
  2. Set Authorization Header: Include the encoded string in the Authorization header with the prefix Basic.

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.

  1. Log in to Katalon TestOps.
  2. Click on your avatar in the top right corner and select User Settings.
  3. Navigate to the Katalon API Key section.
  4. Click Create API Key, provide a name and expiration period, then click Create.
  5. Copy the generated API Key for use in your requests.

Implementation Steps

  1. Encode API Key: Encode your API Key in Base64 with a colon prefix, resulting in :APIKEY.
  2. Set Authorization Header: Include the encoded string in the Authorization header with the prefix Basic.

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

  1. Login request: Send a POST request to the login endpoint with your email and password to receive a JWT token.
    curl --location 'https://api.katalon.com/v1/auth/login' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "email": "email@katalon.com",
      "password": "password"
    }'
    
    This request will return a JSON response containing the JWT token.
    {
        "data": {
            "jwt": "JWT_TOKEN",
            ...
        }
    }
    

    Note: If not authorized, you will get a 401 Unauthorized response.

  2. Use the Token: Include the JWT token in the Authorization header with the prefix Bearer.
    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.