> ## Documentation Index
> Fetch the complete documentation index at: https://platform.atlan.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To act on Atlan objects, use the Atlan MCP server at https://api.atlan.com/mcp or the atlanai CLI; `atlanai --map json` prints its command map. Run a read-only identity check before any write.
> The docs MCP server at /mcp searches these docs only. It cannot read or change Atlan objects.
> SDK packages: Python `atlanai` (PyPI) and TypeScript `@atlanai/sdk` (npm). Show Python first, then TypeScript.

# API automation errors

> Errors from CI authentication, structured output, and direct Gateway API calls.

Errors from CI authentication, `--json` output, and `atlanai api` Gateway calls. Run `atlanai auth status` with the CI token in the environment as the first diagnostic step.

## Exit code `4` on a CI job that was working previously

The job exits with code `4` after previously completing successfully.

### Cause

`ATLANAI_TOKEN` is missing from the environment or the token has been revoked. Exit code `4` always indicates an authentication failure.

### Solution

Verify the token is present and valid in the CI environment.

1. Confirm the secret is set in your CI secret store and has not expired.
2. Run `atlanai auth status` with the token in the environment.
3. Verify the token resolves to the expected account.
4. Rerun the job after confirming the token is valid.

***

## `--json` exits with an error listing valid field names

The command fails and prints the names of the fields the format accepts.

### Cause

The field names passed to `--json` do not match the record's actual field names. The CLI reports each unknown field name and exits with a non-zero code.

### Solution

Use the field names listed in the error output.

1. Read the error output to identify the valid field names for this command.
2. Rerun the command with the correct field names passed to `--json`.

***

## `atlanai api` returns a 403 on a Gateway endpoint

A direct Gateway API call returns a 403 Forbidden response.

### Cause

The authenticated account does not have access to that operation or workspace. Gateway operations enforce workspace-level and operation-level permissions independently.

### Solution

Confirm the account's identity and permissions before retrying.

1. Run `atlanai auth status` to confirm the active identity.
2. Verify the workspace and operation are within the account's permissions.
3. Ask your workspace administrator to grant access if needed.
4. Retry the call after the permission is updated.

## See also

* [Automate workflows](/tools/cli/how-tos/api-automation): Use structured output, stable exit codes, API-key auth, and the Gateway API.
* [Run diagnostics](/tools/cli/troubleshooting/diagnostics): Inspect installation, daemon logs, and authentication state.

## Need help

If you need assistance after trying these steps, contact Atlan support.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.