> For the complete documentation index, see [llms.txt](https://help.aximo.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aximo.autify.com/test-execution-and-plans/api-cicd-integration.md).

# Run with API triggers

With Aximo API triggers, you can run cases and plans from a CI/CD pipeline or any script.

For details about the API endpoints, request bodies, responses, and status values, see the [API Reference](https://aximo.autify.com/docs/api) in Aximo Docs. To delete an existing case from the API, also see the case endpoints in the same API Reference.

## Prerequisites

* You have issued an API key (see [Manage API keys](/settings/api-key-management.md))
* You have enabled **API Access** for the target case or plan

{% hint style="warning" %}
Cases or plans without API access enabled cannot be run from the API.
{% endhint %}

## Enable API access

In the **API Trigger** dialog for cases and plans, toggle API access on or off. The API endpoint and the sample `curl` commands for status check are also available in the same dialog.

The starting point differs between cases and plans, but the steps within the dialog are the same.

### Enable API access for a case

1. In the workspace, open the **Cases** tab, then open the target case.
2. In the upper-right corner of the case detail screen, click **API Trigger**.
3. Turn on **API Access**.

<figure><img src="/files/J9kltfRU9mxaF61S4Vy6" alt="API Trigger dialog for a case screenshot"><figcaption><p>API Trigger dialog for a case</p></figcaption></figure>

4. Note the displayed **API Endpoint** and the sample `curl` commands under **Usage** and **Check Status**.
5. (Mobile cases only) In **Mobile Configuration**, save the device and app to use for API execution.
6. If you do not have an API key, create one from **Manage API Keys** (see [Manage API keys](/settings/api-key-management.md)).

### Enable API access for a plan

1. In the workspace, open the **Plans** tab, then open the target plan.
2. In the upper-right corner of the plan detail screen, click **API Trigger**.
3. Turn on **API Access**.

<figure><img src="/files/FZIXe5xLuZBp87cjeOcz" alt="API Trigger dialog for a plan screenshot"><figcaption><p>API Trigger dialog for a plan</p></figcaption></figure>

4. Note the displayed **API Endpoint** and the sample `curl` commands under **Usage** and **Check Status**.
5. (Plans with mobile cases only) Configure the device and app for execution in the plan's **App & Devices** (see [Manage mobile settings](/test-execution-and-plans/test-plan-specifications.md#manage-mobile-settings)).
6. If you do not have an API key, create one from **Manage API Keys** (see [Manage API keys](/settings/api-key-management.md)).

{% hint style="info" %}
The device and app used when running mobile cases from the API can be saved to the case or plan to omit them from each API request.
{% endhint %}

## Integrate with a CI/CD pipeline

Because API keys are sensitive, register them in the CI/CD secret store and pass them as environment variables. Manage case IDs and plan IDs on the CI/CD side as variables when needed.

In CI/CD, integrate Aximo execution with the following flow.

1. Register the API key as a secret.
2. Check the case or plan API endpoint in Aximo's **API Trigger** dialog.
3. Call the API endpoint from a CI/CD step.
4. Use the ID in the response to periodically call the status endpoint.
5. Treat the CI/CD job as passed or failed based on the execution result.

{% hint style="info" %}
For sample implementations of API calls and status checks, see "Triggering Existing Test Cases," "Triggering Test Plans," and "Polling & Terminal Statuses" in the [API Reference](https://aximo.autify.com/docs/api).
{% endhint %}

## Troubleshooting

### `401 Unauthorized` is returned

**Cause**: The `x-api-key` header is missing, or the API key is invalid.

**Action**: Check that the key is valid on the API key management screen. Recheck the value registered in the secret store, and issue a new key if necessary.

### `403 API access is not enabled for this case` / `for this plan` is returned

**Cause**: API access is disabled for the target case or plan.

**Action**: On the target case detail or plan detail screen, open **API Trigger** and turn on **API Access**.

## Further reading

* [API Reference](https://aximo.autify.com/docs/api)
* [Manage API keys](/settings/api-key-management.md)
* [Manage plans](/test-execution-and-plans/test-plan-specifications.md)
* [Create cases](/test-case-creation/create-test-case.md)
