Authenticate with the v2 API

Send requests to your tenant host, https://<tenant>.katalon.io, over HTTPS.
Authenticate with a Katalon API key. Use HTTP Basic with an empty username
and the API key as the password:
Authorization: Basic <base64(:API_KEY)>.

An API key uses its owner's access; it does not grant additional permissions.
Keep both the key and its Base64 value secret. Encoding is not encryption.

1. Create an API key

  1. Sign in to Katalon True Platform.
  2. Click your profile in the top-right corner and select User Settings.
  3. Select the Katalon API Key tab.
  4. Click Create API Key. Enter a key name, choose an expiration period, and
    optionally add a description.
  5. Click Create, then copy the key.

See Katalon API Key in Katalon True Platform
for details.

2. Find your project ID

Every v2 request needs a numeric project ID in the x-project-id header, even
a request that lists projects.

  1. Open a project you can access in the True Platform UI.
  2. Copy the numeric project ID from the project URL in your browser.
  3. To find other projects, call
    List projects
    with that ID as x-project-id. Use each returned project id as
    x-project-id for that project.

A project ID is not a repository ID. See Know which ID is which.

3. Send project context

  • x-project-id is required on every request.
  • x-account-id selects account context and takes an account UUID, not a
    numeric account ID. Storage and Admin (AUT, environment and custom-field)
    requests require it. Other requests accept it as an option.
  • x-organization-id is optional numeric organization context. If supplied, the
    account and organization must be consistent with the project.

Context headers do not grant membership or permission. Check each operation's
permission requirements and use the correct resource ID type.

4. Pass credentials through curl's standard input

Set KATALON_API_HOST, KATALON_API_KEY, and KATALON_PROJECT_ID from your
environment or secret store. Use the Bash helper below to keep the key out of
curl's command-line arguments. Do not enable shell tracing (set -x). If the key
contains " or \, escape those characters as \" and \\ for curl's
configuration format.

katalon_request() {
  : "${KATALON_API_KEY:?Missing API key}"
  printf 'user = ":%s"\n' "${KATALON_API_KEY}" |
  curl --config - --silent --show-error --fail-with-body \
    --header "x-project-id: ${KATALON_PROJECT_ID:?Missing project ID}" \
    "$@"
}

katalon_request "${KATALON_API_HOST:?Missing tenant host}/v2/schedules"

To select account or organization context, add the corresponding header to a
request. Keep x-project-id in the helper on every call. Do not send your API
key to a separate signed upload or download destination returned by an operation.

Know which ID is which

TermID to useNotes
Projectx-project-id headerThe numeric project ID from step 2.
RepositorytestProjectId in Test Management payloads; id in repository searchA script or test repository inside a project. It is not the project ID.
ScheduleSchedule id in GET /v2/schedulesA saved schedule. Also called a run configuration.
Schedulerschedulers[].id in a scheduleWhen a schedule runs. Use it with startTime to run that occurrence now.
Run configuration entryrunConfigurationEntries[] in a schedule or a test-run requestThe tests, repository (testProjectId), profile and environments to run.
Test runid returned when you start a run; executionId or {id} in /v2/schedules/test-runs pathsOne run of the tests. The guides save it as TEST_RUN_ID.
Test resultexecutionTestResultId in a run's result listOne test case's result in a test run.
Manual executionid or executionId in GET /v2/manual-test/executionsUsed only in /v2/manual-test/executions/... paths.
externalExecutionIdField on a manual executionThe separate TestOps run ID. Use it as sourceId for run-level manual activity. Do not use it in manual-execution paths.
RequirementRequirement idThe True Platform requirement ID. Use it in requirement link requests.
Requirement sourceIdField on a requirementThe ALM issue key, such as DEMO-42. Use it as the issue ID in ALM requests.
Requirement externalIssueIdField on a requirementNot a substitute for the issue key in ALM requests.

Understand authentication errors

StatusWhat to check
401The API key is missing, invalid, or no longer usable. Confirm HTTP Basic uses an empty username and the key as the password.
403The caller lacks access or a required permission, or the supplied context or resource ID is not accepted.
400A required header or parameter is missing, an ID has the wrong form, or a request or filter is invalid. Check the operation's input contract.

A missing x-project-id returns 400 or 403, depending on the operation.
Inspect the response without logging credentials or private test data.

Next steps


Did this page help you?