# Agents

Source: https://docs.autessa.com/docs/api/poweruser/agents

> Poweruser endpoints for creating, configuring, versioning, publishing, sharing, and analyzing agents.

# Agents

Manage the full lifecycle of agents programmatically: create and configure them, publish and roll back versions, inspect conversation history, submit evaluations, and control sharing and ownership.

> All paths on this page are relative to `https://api.autessa.com/autessa_poweruser/agents`. Every request is a POST with a JSON body, and every ID is an opaque string. See the [Poweruser API overview](/docs/api/poweruser.md) for authentication and conventions.

---

## The agent object

Agents are returned as a polymorphic object keyed on `agentType`. All types
share the base fields; each type adds its own configuration on top.

### Base fields

- `agentId` (string) — Unique agent identifier.
- `agentType` (string) — One of `SIMPLE`, `MCP`, `SEARCH`. Immutable after creation, except that an existing `CRITIC` agent may be updated to `SIMPLE` (see [Critic agents](#critic-agents)). `CRITIC` appears only on older agents.
- `versionNumber` (integer) — Version number when reading a specific published or archived version; absent on the draft working copy.
- `name` (string) — Display name.
- `description` (string) — What the agent does. Used by managers when deciding which agent to invoke.
- `agentInstructions` (string) — The system prompt. May contain `@@{variableName}@@` placeholders that are filled from `promptTemplateVariables` at execution time.
- `model` (string) — Model alias: `BIG_INSTRUCTION_FOLLOWING_REASONING`, `BIG_INSTRUCTION_FOLLOWING`, `SMALL_INSTRUCTION_FOLLOWING`, `VIBE_CODING`, or `AUTESSA_120B`.
- `voiceConfig` (object) — Voice settings for audio output: `voiceModel` (`SMALL`, `MEDIUM`, `LARGE`) and `voiceName`.
- `promptTemplateVariables` (object) — Map of variable name to argument definition (`description`, `isRequired`, `argumentSchema` — a JSON Schema object).
- `evaluationNotes` (string) — Grading rubric used by automated evaluation.
- `lastPublishedTime` (string) — ISO-8601 timestamp of the last publish, or absent if never published.
- `tags` (array<string>) — Free-form organizational tags.
- `enableBrowserTools` (boolean) — Whether the agent may use built-in browser tools.
- `sensitiveDataProtection` (object) — Catches card numbers, bank details, SSNs, and your own account numbers in what people send the agent and replaces them with placeholders such as `[card ending 4242, exp 08/29 — saved as PM_1]` before the model reads them. Fields: `enabled` (boolean, default `false`), `detectors` (array of `PAYMENT_CARD`, `BANK_ACCOUNT`, `SSN`, `ACCOUNT`; defaults to the first three), `accountNumberPattern` (string — a regular expression for your own account numbers, needed for `ACCOUNT`), `modelPass` (boolean — also check long, messy messages with a private model; default `false`), and `ttlMinutes` (integer — the longest a value is kept; default `240`). Absent means off. See [Protect Sensitive Data](/docs/guide/agentic/sensitive-data.md).
- `voiceToolAnnouncements` (object) — What the voice says on its own while tools run on a call or in voice mode: `mode` (`SMART`, the default, says one short line as the turn's first tool starts, unless the agent already spoke that turn; `CUSTOM_ONLY` speaks only for tools with their own `voiceAnnouncement` phrases; `OFF` never speaks), `delayMs` (integer — for tools set to `when: IF_SLOW` only, the silence before their line; default `1500`), and `longWaitMs` (integer — when a still-running tool gets one "still working" line; default `8000`). Absent means `SMART` with the defaults; on update, omitted keeps the current setting. See [What the voice says while tools run](/docs/guide/agentic/phone-numbers.md#what-the-voice-says-while-tools-run).
- `languages` (array<LanguageEntry>) — The languages the agent speaks on calls, up to 10, each in the [language entry](#language-entries) shape. With two or more, calls start in `defaultLanguage` and switch for good to another listed language once the caller says 3 or more words in it. With none, or only an English one, the agent works as it always has; with only a Spanish one, every call is in Spanish from the start. On update, omit it to keep the current languages; send `[]` to clear them. See [Agents that speak more than one language](/docs/guide/agentic/phone-numbers.md#agents-that-speak-more-than-one-language).
- `defaultLanguage` (string) — The language calls start in, such as `en-US`. Must be one of the codes in `languages`. Absent means the first entry in `languages`, or `en-US` when there are none. On update, omit it to keep the current value.
- `listening` (object) — How the agent listens on phone calls, in the [listening settings](#listening-settings) shape. Every field is optional; a field that isn't set uses the phone number's [AI call behavior](/docs/api/poweruser/phone-numbers.md#update-call-settings), and then the default. A field set here wins over the number's. On update, omit `listening` to keep the current settings; send `{}` to clear them. The object you send replaces the stored one as a whole. See [Agent listening and keypad settings](/docs/guide/agentic/phone-numbers.md#agent-listening-and-keypad-settings).

### Language entries

- `language` (string, required) — The language code: `en-US`, `en-GB`, `es-US`, or `es-ES`. Assistants support English and Spanish only right now; any other code is rejected with "Only English and Spanish are supported for the assistant's languages right now." Each language can appear once per agent.
- `voice` (object) — The voice for this language, in the same shape as `voiceConfig` (`voiceModel` and `voiceName`). Absent means the agent's own voice.
- `greeting` (string) — Up to 500 characters. The default language's greeting is spoken at the start of a call, unless the phone number or the outgoing call has a greeting of its own.
- `instructions` (string) — Up to 4,000 characters, added to `agentInstructions`. The default language's instructions apply from the start of the call; another language's are added once the call switches to it.
- `fillerPhrases` (array<string>) — Short lines said while tools run, up to 10, each up to 200 characters. Empty means the built-in lines, which exist for English and Spanish; other languages say no general line without phrases of their own.
- `longWaitPhrases` (array<string>) — The "still working" lines for a tool that runs a while, with the same limits and defaults as `fillerPhrases`.
- `errorMessage` (string) — What a caller hears, or a texter reads, if something goes wrong partway through a phone call or text conversation, up to 300 characters. They never see error details. Empty means the built-in line, in English or Spanish.

A setting that doesn't fit these rules is rejected with a plain sentence,
such as `"Spanish (US) is listed twice in Languages."`

### Listening settings

- `keypad` (object) — Caller key presses. `mode` — `OFF` (key presses are ignored), `WHEN_ASKED` (the agent asks for numbers with the [`PHONE_KEYPAD_INPUT`](/docs/tools/phone-sms.md#ask-for-keypad-entry-) tool), or `ANY_TIME` (callers type whenever they like); unset means the number's `ai.passKeypresses` (`true` is `ANY_TIME`, otherwise `OFF`). Any other value is rejected with "Keypad entry must be Off, When the agent asks, or Any time." `finishKey` (`"#"`, the default, `"*"`, or `"NONE"` to end an entry only by the pause) and `digitTimeoutSeconds` (integer, 1 to 10, default `3` — how long to wait for the next key before sending the entry) apply to both modes; the tool uses this finish key unless it sets its own. With `ANY_TIME`, the agent gets an entry as `Caller typed on the keypad: 4821`, and a finish key on its own as `Caller pressed #`. `ANY_TIME` doesn't apply on numbers that add listeners to every call or on outgoing calls that dial other people in as they start, and stops once a call is transferred or someone is added; the agent can still ask with the tool. Saving `WHEN_ASKED` without the tool isn't an error, but the agent can't ask for numbers until it has it. Keypad entry doesn't apply in voice mode.
- `endOfTurn` (string) — How long the agent waits after the caller stops talking: `FAST`, `NORMAL`, or `PATIENT`. Unset means the number's `ai.endOfTurn`, else `NORMAL`.
- `endOfTurnSeconds` (number) — An exact pause before replying, from `0.2` to `4.0` seconds: how long the caller can go quiet mid-sentence before the agent answers. Replaces `endOfTurn` when set.
- `background` (string) — How noisy callers' surroundings are: `QUIET`, `NORMAL` (the default), or `NOISY`. Noisier settings need a clearly louder voice before it counts as the caller talking.
- `voiceAboveNoiseDb` (number) — How much louder than the room a voice must be to count as talking, from `3` to `25` dB. Replaces `background` when set.
- `noiseSuppression` (boolean) — **Reduce background noise** for this agent. Unset means the number's `speech.noiseSuppression`, else off.

A value out of range is rejected with a plain sentence, such as
`"The pause before the agent replies must be between 0.2 and 4 seconds."`

### Type-specific fields

- `maxIterations` (integer) — `SIMPLE`, `MCP`, `SEARCH` — maximum reasoning/tool loop iterations per turn (default `10`).
- `tools` (array<Tool>) — `SIMPLE`, `SEARCH` — tools attached to the agent. See [Tools](/docs/api/poweruser/tools.md).
- `mcpServerId` (string) — `MCP` — the MCP server whose tools the agent uses.
- `autessaDbTableId` (string) — `SEARCH` — the AutessaDB table to search.
- `searchColumnName` (string) — `SEARCH` — the column that is semantically indexed.
- `topK` (integer) — `SEARCH` — number of results to retrieve (default `5`).
- `scoreThreshold` (number) — `SEARCH` — minimum similarity score (default `0.7`).
- `responseChecks` (ResponseChecksConfig) — `SIMPLE` — checks every reply must pass before the customer receives it. See [Response checks](#response-checks).

```json title="Agent object (SIMPLE)"
{
  "agentId": "V1StGXR8Z5",
  "agentType": "SIMPLE",
  "name": "Support Triage Agent",
  "description": "Classifies inbound support tickets and drafts replies.",
  "agentInstructions": "You are a support triage specialist for @@{companyName}@@ ...",
  "model": "BIG_INSTRUCTION_FOLLOWING",
  "voiceConfig": {
    "voiceModel": "SMALL",
    "voiceName": "FEMALE"
  },
  "promptTemplateVariables": {
    "companyName": {
      "description": "Company the agent represents",
      "isRequired": true,
      "argumentSchema": { "type": "string" }
    }
  },
  "evaluationNotes": "A good response classifies the ticket and drafts a reply.",
  "lastPublishedTime": "2026-06-28T17:42:10",
  "tags": ["support"],
  "enableBrowserTools": false,
  "sensitiveDataProtection": {
    "enabled": true,
    "detectors": ["PAYMENT_CARD", "BANK_ACCOUNT", "SSN"],
    "modelPass": false,
    "ttlMinutes": 240
  },
  "defaultLanguage": "en-US",
  "languages": [
    {
      "language": "en-US",
      "greeting": "Thanks for calling Cedar Bay Dental, how can I help?"
    },
    {
      "language": "es-US",
      "voice": { "voiceModel": "MEDIUM", "voiceName": "FEMALE" },
      "greeting": "Gracias por llamar a Cedar Bay Dental, ¿en qué le puedo ayudar?",
      "instructions": "Address callers formally, using usted.",
      "fillerPhrases": ["Un momento, por favor."],
      "longWaitPhrases": ["Ya casi termino."]
    }
  ],
  "maxIterations": 10,
  "tools": [
    {
      "toolId": "kZ3mQ9pW2x",
      "name": "LookupOrder",
      "description": "Looks up an order by ID in AutessaDB."
    }
  ]
}
```

---

## Response checks

`SIMPLE` agents carry an optional `responseChecks` object: checks that every
reply must pass before the customer receives it. See the
[Response Checks guide](/docs/guide/agentic/response-checks.md) for what each
check catches and how replies are released. All checks run at the same time.
A check that can't run counts as failed, unless its action is `FLAG`.

### ResponseChecksConfig

- `checks` (array<ResponseCheck>) — The checks, in display order. Empty or absent means no checks.
- `fallbackMessage` (string) — Sent in place of a blocked reply. Null or blank uses "Sorry, I can't share that. Is there anything else I can help you with?"
- `maxRegenerations` (integer) — How many new replies a `REGENERATE_THEN_BLOCK` or `REGENERATE_THEN_SEND` check may ask for before it gives up (default `2`).

### Fields on every check

- `checkType` (string, required) — `GROUNDING`, `PATTERN`, `BUILT_IN`, `SCRIPT`, or `AI_REVIEW`. Selects which type-specific fields apply.
- `id` (string, required) — A unique ID you generate for the check (a UUID works). Results refer to the check by this ID.
- `name` (string) — Display name shown in results.
- `enabled` (boolean) — Whether the check runs (default `true`).
- `action` (string) — What happens when the check fails: - `FLAG`: send the reply unchanged and record the problem. - `REDACT`: replace the matched text with `[REDACTED]` and send the rest. Not allowed on `AI_REVIEW`. - `BLOCK`: send `fallbackMessage` instead. - `REGENERATE_THEN_BLOCK`: ask the agent for a new reply, up to `maxRegenerations` times, then send `fallbackMessage`. - `REGENERATE_THEN_SEND`: ask for a new reply, up to `maxRegenerations` times, then send the last one.

### GROUNDING fields

Fails when a fact in the reply doesn't appear in the conversation, tool
requests and results, retrieved knowledge, or the agent's instructions and
prompt variables.

- `factTypes` (array<string>) — Which facts to check: any of `NUMBERS`, `DATES`, `URLS`, `EMAILS`, `PHONES`, `IDENTIFIERS`, `QUOTES`. Defaults to all.
- `allowedValues` (array<string>) — Facts the agent may always state, such as your support phone number.

### PATTERN fields

- `pattern` (string, required) — The regular expression to look for.
- `flags` (string) — Any of `i`, `m`, `s`, `u`, `x`.
- `requiredContextKeywords` (array<string>) — When set, a match counts only if one of these words is within 80 characters of it.
- `luhn` (boolean) — When `true`, a match counts only if it passes the card-number checksum.

### BUILT_IN fields

- `detectors` (array<string>, required) — Any of `SSN`, `CREDIT_CARD`, `BANK_ACCOUNT`, `US_DRIVERS_LICENSE`, `EMAIL`, `PHONE`, `IP_ADDRESS`, `IBAN`, `DOB`, `SECRETS` (API keys, tokens and private keys), `PRIVATE_VALUES` (values the customer entered for a private argument, or secret values, repeated word for word), `INSTRUCTIONS_LEAK` (a long run of words copied from the agent's instructions), and `INTERNAL_URLS` (local, private-network and internal-only addresses).
- `instructionsLeakWords` (integer) — For `INSTRUCTIONS_LEAK`: how many words in a row count as a leak (default `12`).
- `internalDomains` (array<string>) — For `INTERNAL_URLS`: extra domains to treat as internal.

### SCRIPT fields

- `script` (string, required) — An [AutessaScript](/docs/autessascript.md) that reads `variables.response` (the reply), `variables.segment` (the sentence being released; equals `variables.response` when the whole reply is checked) and `variables.history` (a JSON string: an array of `{role, name?, content}` with `role` one of `user`, `assistant`, `tool`). It must call `response.setResponse({ pass, reason?, matches? })`, where `matches` are exact substrings of `variables.response`. Runs without platform calls or network access, with a 2-second limit.

### AI_REVIEW fields

- `goodCriteria` (array<string>) — What every reply must do. May use `@@{variable}` placeholders.
- `badCriteria` (array<string>) — What no reply may do. May use `@@{variable}` placeholders.
- `model` (string) — Model alias for the reviewer (default `SMALL_INSTRUCTION_FOLLOWING`).
- `customModel` (object) — A model from one of your company's [model connections](/docs/guide/company/model-privacy.md). Overrides `model`. Null to use `model`.
- `contextExchanges` (integer) — How many earlier exchanges the reviewer sees (default `3`).

### Critic agents

`CRITIC` agents can no longer be created. Existing ones keep running. If one
has criteria and no enabled checks, it behaves as if it had one `AI_REVIEW`
check with action `REGENERATE_THEN_SEND`, built from its `goodCriteria`,
`badCriteria`, `criticModel`, `customCriticModel` and
`criticContextExchanges`, with `maxRegenerations` taken from
`maxCriticIterations`. To move one over, send it to
[`/update`](#update-an-agent) with `agentType: "SIMPLE"` and a
`responseChecks` object. This is the only type change `/update` allows.

```json title="responseChecks"
{
  "responseChecks": {
    "fallbackMessage": "Sorry, I can't share that. Can I help with anything else?",
    "maxRegenerations": 2,
    "checks": [
      {
        "checkType": "GROUNDING",
        "id": "3f1c9a52-7d4e-4b8a-9c11-2e6f0a7b5d93",
        "name": "No made-up prices or order numbers",
        "action": "BLOCK",
        "factTypes": ["NUMBERS", "IDENTIFIERS"],
        "allowedValues": ["1-800-555-0100"]
      },
      {
        "checkType": "BUILT_IN",
        "id": "a8d27e10-4c6b-4f3e-8d2a-71b9c0e4f512",
        "name": "Sensitive data",
        "action": "REDACT",
        "detectors": ["SSN", "CREDIT_CARD", "SECRETS", "PRIVATE_VALUES"]
      },
      {
        "checkType": "AI_REVIEW",
        "id": "c6e0b3d4-1a9f-4e27-b5c8-0d3f6a2e9b71",
        "name": "Policy review",
        "action": "REGENERATE_THEN_BLOCK",
        "goodCriteria": ["Answers the customer's actual question"],
        "badCriteria": ["Promises a delivery date"],
        "model": "SMALL_INSTRUCTION_FOLLOWING",
        "contextExchanges": 3
      }
    ]
  }
}
```

---

## AI Application Firewall

An agent's [AI Application Firewall](/docs/guide/agentic/ai-application-firewall.md)
setting isn't a field on the agent object, so `create` and `update` don't
change it. It's stored with the company's firewall policies, and you set it
in the agent's **AI Application Firewall** card, or with
`autessa.agentFirewall.getPolicy` and `putPolicy` in AutessaScript.
Copying an agent or installing it from the Marketplace copies its setting.

### Agent policy fields

- `agentId` (string) — The agent.
- `agentSetting` (string) — `COMPANY` (use the company policy, the default), `CUSTOM` (use the sections sent with it), or `OFF` (the firewall's checks don't run for the agent; tools with `authGate` still require verification).
- `mode` (string) — `CUSTOM` only: `MONITOR` (detected risks are only flagged; tools with `authGate` still require verification) or `ENFORCE`.
- `rules` (array<Rule>) — `CUSTOM` only: the agent's ordered [custom rules](/docs/api/ai-application-firewall.md#custom-rules). Sending the list replaces the whole list.
- `voiceAuthenticity, wordOfDay, challenge, anomaly, callerId, socialEngineering, disclosure, watermark` (object) — `CUSTOM` only: the checks, with the same fields as the [policy sections](/docs/api/ai-application-firewall.md#policy-sections). A section left out keeps its stored value; `{"enabled": false}` turns a check off.

When a tool with [verification](/docs/api/poweruser/tools.md#the-tool-object)
turned on is about to run and the user hasn't verified, the turn pauses
and the execution response carries an `authChallengeRequest`. See
[Verification in agent conversations](/docs/api/ai-application-firewall.md#verification-in-agent-conversations).

```json title="putPolicy (Custom for one agent)"
{
  "agentId": "V1StGXR8Z5",
  "agentSetting": "CUSTOM",
  "mode": "ENFORCE",
  "voiceAuthenticity": { "enabled": true, "threshold": 0.5, "action": "CHALLENGE" },
  "challenge": { "methods": ["WORD_OF_DAY", "TOTP"], "maxAttempts": 3 },
  "disclosure": { "enabled": true, "perConversation": 5, "perDay": 20, "action": "BLOCK" }
}
```

```json title="putPolicy (turn it off for one agent)"
{
  "agentId": "V1StGXR8Z5",
  "agentSetting": "OFF"
}
```

---

## Versioning and access levels

Agents follow the platform-wide draft/published model (see the
[Versions guide](/docs/guide/agentic/versions.md)):

- **Draft** — [`/update`](#update-an-agent) always edits the draft working copy.
  Draft changes are never visible to executions that use the published
  version.
- **Published** — [`/publish`](#publish-an-agent) snapshots the draft as a new
  published version; the previously published version becomes **archived**.
- **Rollback** — [`/rollback`](#roll-back-an-agent) republishes an archived
  version. The draft is untouched.

Endpoints enforce the caller's access level on the agent (the poweruser key
acts as its linked user):

| Operation | Required access |
|-----------|-----------------|
| `get`, `all`, `versions`, `conversations/*`, `statistics` | Any access (READ or higher) |
| `update` | WRITE, PUBLISH, or ADMIN |
| `publish`, `rollback` | PUBLISH or ADMIN |
| `delete`, `share` | ADMIN |
| `transfer-ownership` | Owner only |

---

## Create an agent

**POST** `/agents/create`

Creates a new agent as a draft. `agentName` and `agentDescription` are both
required — creation fails with an error message if either is blank. Configure
instructions, model, and tools afterwards with [`/update`](#update-an-agent),
then [`/publish`](#publish-an-agent) to make it executable.

### Request parameters

- `agentType` (string, required) — `SIMPLE`, `MCP`, or `SEARCH`. `CRITIC` can no longer be created; add an `AI_REVIEW` [response check](#response-checks) to a `SIMPLE` agent instead.
- `agentName` (string, required) — Display name. Must be non-blank.
- `agentDescription` (string, required) — Description of the agent's purpose. Must be non-blank.
- `mcpServerId` (string) — `MCP` agents only — the MCP server to bind.
- `autessaDbTableId` (string) — `SEARCH` agents only — the AutessaDB table to search.
- `searchColumnName` (string) — `SEARCH` agents only — the indexed column to search over.
- `topK` (integer) — `SEARCH` agents only — number of results to retrieve.
- `scoreThreshold` (number) — `SEARCH` agents only — minimum similarity score.
- `enableAutoContext` (boolean) — `SEARCH` agents only — automatically inject retrieved context.

### Response

- `agent` (Agent) — The newly created agent object.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/agents/create \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentType": "SIMPLE",
    "agentName": "Support Triage Agent",
    "agentDescription": "Classifies inbound support tickets and drafts replies."
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/agents/create',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      agentType: 'SIMPLE',
      agentName: 'Support Triage Agent',
      agentDescription: 'Classifies inbound support tickets and drafts replies.'
    })
  }
);

const { agent } = await response.json();
console.log(agent.agentId);
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/agents/create',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'agentType': 'SIMPLE',
        'agentName': 'Support Triage Agent',
        'agentDescription': 'Classifies inbound support tickets and drafts replies.'
    }
)

agent = response.json()['agent']
```

```json title="Response"
{
  "agent": {
    "agentId": "V1StGXR8Z5",
    "agentType": "SIMPLE",
    "name": "Support Triage Agent",
    "description": "Classifies inbound support tickets and drafts replies.",
    "agentInstructions": "You are a professional agent who does as asked.",
    "model": "SMALL_INSTRUCTION_FOLLOWING",
    "maxIterations": 10,
    "tools": []
  },
  "errors": []
}
```

---

## Get an agent

**POST** `/agents/get`

Retrieves an agent's full configuration. Without a `version` parameter you
get the current draft working copy; pass `version` to read a specific
published or archived snapshot.

### Request parameters

- `agentId` (string, required) — The agent to fetch.
- `version` (object) — Optional version selector: `versionState` (`PUBLISHED`, `DRAFT`, or `ARCHIVED`; defaults to `PUBLISHED` when the object is present) and an optional `versionNumber`.

### Response

- `agent` (Agent) — The agent object.
- `permission` (string) — The calling user's access level on this agent: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `voiceOptionsList` (array<VoiceOptions>) — Voice models available to the company, each with `voiceModel` and a `voices` object listing `builtInVoiceNames` and `customVoiceNames` (custom voice clones, on supported models).
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/agents/get \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "version": { "versionState": "PUBLISHED" }
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/agents/get',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ agentId: 'V1StGXR8Z5' })
  }
);

const { agent, permission } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/agents/get',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={'agentId': 'V1StGXR8Z5'}
)

data = response.json()
```

```json title="Response (truncated)"
{
  "agent": {
    "agentId": "V1StGXR8Z5",
    "agentType": "SIMPLE",
    "name": "Support Triage Agent",
    "model": "BIG_INSTRUCTION_FOLLOWING",
    "maxIterations": 10,
    "tools": [{ "toolId": "kZ3mQ9pW2x", "name": "LookupOrder" }]
  },
  "permission": "ADMIN",
  "voiceOptionsList": [
    {
      "voiceModel": "SMALL",
      "voices": {
        "builtInVoiceNames": ["FEMALE", "MALE"],
        "customVoiceNames": []
      }
    }
  ],
  "errors": []
}
```

---

## List all agents

**POST** `/agents/all`

Lists every agent visible to the linked user, grouped by how they have
access. Entries are lightweight summaries — use [`/get`](#get-an-agent) for full
configuration.

### Request parameters

None — send an empty object `{}`.

### Response

- `ownedAgents` (array<Agent>) — Agents the linked user owns.
- `companySharedAgents` (array<Agent>) — Agents shared with the whole company.
- `sharedWithMeAgents` (array<Agent>) — Agents shared specifically with the linked user.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/all \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json title="Response"
{
  "ownedAgents": [
    {
      "agentId": "V1StGXR8Z5",
      "agentType": "SIMPLE",
      "name": "Support Triage Agent",
      "description": "Classifies inbound support tickets and drafts replies.",
      "tags": ["support"],
      "lastPublishedTime": "2026-06-28T17:42:10"
    }
  ],
  "companySharedAgents": [],
  "sharedWithMeAgents": [],
  "errors": []
}
```

---

## Update an agent

**POST** `/agents/update`

Replaces the agent's draft configuration with `updatedAgent`. This is a
whole-object update: fetch the draft with [`/get`](#get-an-agent), modify it,
and send the full object back. Published versions are unaffected until you
[`/publish`](#publish-an-agent).

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `agentId` (string, required) — The agent to update.
- `updatedAgent` (Agent, required) — The complete agent object to store as the new draft. Uses the [agent object](#the-agent-object) shape; `agentType` must match the existing agent.

### Response

- `updatedAgent` (Agent) — The stored draft.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/agents/update \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "updatedAgent": {
      "agentId": "V1StGXR8Z5",
      "agentType": "SIMPLE",
      "name": "Support Triage Agent",
      "description": "Classifies inbound support tickets and drafts replies.",
      "agentInstructions": "You are a support triage specialist. Classify each ticket ...",
      "model": "BIG_INSTRUCTION_FOLLOWING",
      "maxIterations": 10,
      "tools": [{ "toolId": "kZ3mQ9pW2x" }]
    }
  }'
```

**JavaScript:**

```javascript
// Read-modify-write the draft
const getResp = await fetch(
  'https://api.autessa.com/autessa_poweruser/agents/get',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ agentId: 'V1StGXR8Z5' })
  }
);
const { agent } = await getResp.json();

agent.model = 'BIG_INSTRUCTION_FOLLOWING';
agent.agentInstructions = 'You are a support triage specialist ...';

await fetch(
  'https://api.autessa.com/autessa_poweruser/agents/update',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ agentId: agent.agentId, updatedAgent: agent })
  }
);
```

**Python:**

```python
import os
import requests

headers = {'Authorization': os.environ['POWERUSER_KEY']}
base = 'https://api.autessa.com/autessa_poweruser/agents'

agent = requests.post(f'{base}/get', headers=headers,
                      json={'agentId': 'V1StGXR8Z5'}).json()['agent']

agent['model'] = 'BIG_INSTRUCTION_FOLLOWING'

requests.post(f'{base}/update', headers=headers,
              json={'agentId': agent['agentId'], 'updatedAgent': agent})
```

```json title="Response (truncated)"
{
  "updatedAgent": {
    "agentId": "V1StGXR8Z5",
    "agentType": "SIMPLE",
    "name": "Support Triage Agent",
    "model": "BIG_INSTRUCTION_FOLLOWING"
  },
  "errors": []
}
```

---

## Publish an agent

**POST** `/agents/publish`

Snapshots the current draft as a new published version. Client API
executions that don't pin a version always use the latest published version.
The previously published version becomes archived and remains available for
[`/rollback`](#roll-back-an-agent).

Requires PUBLISH or ADMIN access.

### Request parameters

- `agentId` (string, required) — The agent to publish.

### Response

- `publishedAgentVersion` (integer) — The new published version number.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/publish \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "publishedAgentVersion": 4,
  "errors": []
}
```

---

## Roll back an agent

**POST** `/agents/rollback`

Republishes an archived version, making it the live published version again.
The draft working copy is not changed. Use [`/versions`](#list-versions) to
find rollback candidates.

Requires PUBLISH or ADMIN access.

### Request parameters

- `agentId` (string, required) — The agent to roll back.
- `versionToRollback` (integer, required) — The archived version number to republish.

### Response

- `newPublishedVersion` (integer) — The version number now published.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/rollback \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "V1StGXR8Z5", "versionToRollback": 3 }'
```

```json title="Response"
{
  "newPublishedVersion": 5,
  "errors": []
}
```

---

## List versions

**POST** `/agents/versions`

Returns the agent's published version and all archived version numbers.

### Request parameters

- `agentId` (string, required) — The agent to inspect.

### Response

- `currentPublishedVersion` (integer) — The live published version, or absent if the agent was never published.
- `archivedVersions` (array<integer>) — Previously published version numbers available for rollback.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/versions \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "currentPublishedVersion": 4,
  "archivedVersions": [1, 2, 3],
  "errors": []
}
```

---

## List conversations

**POST** `/agents/conversations/history`

Returns the agent's conversation history, newest first, paginated.

### Request parameters

- `agentId` (string, required) — The agent whose conversations to list.
- `page` (integer) — Zero-based page index. Defaults to `0`.
- `includeMySandboxConversations` (boolean) — Also include the calling user's sandbox (Builder test) conversations. Defaults to `false`.

### Response

- `conversations` (array<Conversation>) — Conversation records. Each has `resourceId` (the agent's ID), `version`, `conversationId`, `apiKeyId`, `closeDate`, `channel` (`PHONE`, `SMS`, `WEB_CHAT`, `APP`, or `API`), `businessNumber` and `otherNumber` (your number and the other person's, for phone calls and texts), `language` (the language the conversation settled on, such as `es-US`, for agents with [more than one language](#language-entries); `null` otherwise, or when the conversation ended before it settled), `logs` (see [conversation logs](#conversation-logs)), and an optional `evaluationContext`.
- `totalElements` (integer) — Total conversations across all pages.
- `totalPages` (integer) — Total number of pages.
- `currentPage` (integer) — The page returned.
- `pageSize` (integer) — Conversations per page.
- `hasNext` (boolean) — Whether another page exists.
- `hasPrevious` (boolean) — Whether a previous page exists.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/agents/conversations/history \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "V1StGXR8Z5", "page": 0 }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/agents/conversations/history',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ agentId: 'V1StGXR8Z5', page: 0 })
  }
);

const { conversations, hasNext } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/agents/conversations/history',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={'agentId': 'V1StGXR8Z5', 'page': 0}
)

data = response.json()
```

```json title="Response (truncated)"
{
  "conversations": [
    {
      "resourceId": "V1StGXR8Z5",
      "version": "4",
      "conversationId": "conv_a1b2c3d4e5",
      "apiKeyId": "key_xyz",
      "closeDate": "2026-06-30T09:15:22",
      "channel": "API",
      "businessNumber": null,
      "otherNumber": null,
      "language": null,
      "logs": [
        {
          "logType": "USER",
          "userMultimodalInputs": [
            { "inputType": "TEXT", "content": "My order is late." }
          ]
        },
        {
          "logType": "MESSAGE_TO_USER",
          "multimodalOutput": {
            "outputType": "TEXT",
            "content": "I'm sorry to hear that — let me look it up."
          }
        }
      ],
      "evaluationContext": null
    }
  ],
  "totalElements": 128,
  "totalPages": 13,
  "currentPage": 0,
  "pageSize": 10,
  "hasNext": true,
  "hasPrevious": false,
  "errors": []
}
```

### Conversation logs

Each entry in `logs` has a `logType` that determines which other fields are
present:

| logType | Payload |
|---------|---------|
| `USER` | `userMultimodalInputs` — array of text/audio inputs from the user. |
| `MESSAGE_TO_USER` | `multimodalOutput` — the agent's text or audio response. |
| `TOOL_REQUEST` | `executeToolRequest` — `toolCallId`, tool `name`, and `variables`. |
| `TOOL_RESPONSE` | `executeToolResponse` — `toolCallId`, `toolName`, and the tool's `result`. |

Audio entries additionally carry playback metadata (`playbackState`,
`playbackStartedAt`, `playbackCompletedAt`, `spokenContent` when a response
was interrupted). Agents with response checks add a `RESPONSE_CHECK` entry
after each checked reply, with a `responseCheckResult` object (see
[Agents API](/docs/api/agents.md#response-check-log)). Older conversations from
`CRITIC` agents can also contain `CRITIC_REJECTED_MESSAGE` entries with
`criticEvaluation` and `criticAttemptNumber`.

---

## Get a conversation

**POST** `/agents/conversations/conversation`

Fetches a single conversation by ID — unlike
[`/conversations/history`](#list-conversations) this is not paginated, so
deep links to older conversations resolve directly.

### Request parameters

- `agentId` (string, required) — The agent the conversation belongs to.
- `conversationId` (string, required) — The conversation to fetch.

### Response

- `conversation` (Conversation) — The conversation record, same shape as entries in [`/conversations/history`](#list-conversations).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/conversations/conversation \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "conversationId": "conv_a1b2c3d4e5"
  }'
```

```json title="Response (truncated)"
{
  "conversation": {
    "resourceId": "V1StGXR8Z5",
    "version": "4",
    "conversationId": "conv_a1b2c3d4e5",
    "logs": [ { "logType": "USER", "userMultimodalInputs": [] } ],
    "evaluationContext": {
      "humanEvaluation": {
        "status": "SUCCESSFUL",
        "notes": "Resolved on first contact.",
        "evaluationTime": "2026-06-30T10:02:44"
      }
    }
  },
  "errors": []
}
```

---

## Submit a human evaluation

**POST** `/agents/submit-evaluation`

Attaches a human evaluation to a conversation. Human evaluations take
precedence over automated ones in [statistics](#get-statistics). The
evaluation timestamp and evaluator are set server-side from the calling
user — you only supply the verdict and notes.

### Request parameters

- `agentId` (string, required) — The agent the conversation belongs to.
- `conversationId` (string, required) — The conversation being evaluated.
- `humanEvaluation` (object, required) — The evaluation payload.
- `humanEvaluation.status` (string, required) — One of `SUCCESSFUL`, `SUCCESSFUL_NOT_EFFICIENT`, `SUCCESSFUL_NOT_ALL_STEPS`, `UNSUCCESSFUL`.
- `humanEvaluation.notes` (string) — Free-form reviewer notes.

### Response

- `errors` (array<string>) — Error messages, if any occurred (for example `"Conversation not found"`).

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/submit-evaluation \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "conversationId": "conv_a1b2c3d4e5",
    "humanEvaluation": {
      "status": "SUCCESSFUL",
      "notes": "Resolved on first contact."
    }
  }'
```

```json title="Response"
{
  "errors": []
}
```

---

## Get statistics

**POST** `/agents/statistics`

Aggregated evaluation statistics for an agent, optionally windowed by date,
with a per-version breakdown.

### Request parameters

- `agentId` (string, required) — The agent to analyze.
- `startDate` (string) — ISO-8601 date-time lower bound (for example `"2026-06-01T00:00:00"`).
- `endDate` (string) — ISO-8601 date-time upper bound.

### Response

- `statistics` (object) — The statistics envelope.
- `statistics.totalConversations` (integer) — Conversations in the window.
- `statistics.humanEvaluation` (EvaluationStats) — Counts from human evaluations: `totalEvaluated`, `successful`, `successfulNotEfficient`, `successfulNotAllSteps`, `unsuccessful`.
- `statistics.automatedEvaluation` (EvaluationStats) — Same counts from automated evaluation.
- `statistics.humanPrecedenceEvaluation` (EvaluationStats) — Merged view where a human verdict overrides the automated one for the same conversation.
- `statistics.versionBreakdown` (object) — Map of version number to a per-version stats object with the same four fields.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/statistics \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "startDate": "2026-06-01T00:00:00",
    "endDate": "2026-07-01T00:00:00"
  }'
```

```json title="Response (truncated)"
{
  "statistics": {
    "totalConversations": 128,
    "humanEvaluation": {
      "totalEvaluated": 40,
      "successful": 31,
      "successfulNotEfficient": 4,
      "successfulNotAllSteps": 2,
      "unsuccessful": 3
    },
    "automatedEvaluation": {
      "totalEvaluated": 128,
      "successful": 97,
      "successfulNotEfficient": 12,
      "successfulNotAllSteps": 8,
      "unsuccessful": 11
    },
    "humanPrecedenceEvaluation": {
      "totalEvaluated": 128,
      "successful": 99,
      "successfulNotEfficient": 11,
      "successfulNotAllSteps": 8,
      "unsuccessful": 10
    },
    "versionBreakdown": {
      "4": { "totalConversations": 74 }
    }
  },
  "errors": []
}
```

---

## Delete an agent

**POST** `/agents/delete`

Permanently deletes an agent, including its draft and version history. This
is destructive and cannot be undone.

Requires ADMIN access on the agent.

### Request parameters

- `agentId` (string, required) — The agent to delete.

### Response

- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/delete \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "errors": []
}
```

---

## Share an agent

**POST** `/agents/share`

Sets the agent's sharing level and per-user grants in one call.

Requires ADMIN access on the agent.

> This endpoint changes the same sharing as the [Share dialog](/docs/guide/platform/sharing.md). Sharing with `COMPANY` adds a company-wide grant and keeps everyone already shared individually at their own level. People get the highest level from any grant that covers them.

### Request parameters

- `agentId` (string, required) — The agent to share.
- `level` (string) — Sharing level: `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `accessLevel` (string) — When `level` is `COMPANY`, the access level every company member gets: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `usersToAdd` (array<UserShare>) — Users to grant access. Each entry: `userEmail` or `userId` (string), plus `accessLevel`.
- `usersToRemove` (array<UserShare>) — Users whose access to revoke, same entry shape.

### Response

- `level` (string) — The resulting sharing level.
- `accessLevel` (string) — The resulting company-wide access level, when shared with the company.
- `usersWithAccess` (array<UserShare>) — The resulting per-user grants.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/share \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "level": "SPECIFIC_MEMBER",
    "usersToAdd": [
      { "userEmail": "sam@acme.com", "accessLevel": "WRITE" }
    ],
    "usersToRemove": []
  }'
```

```json title="Response"
{
  "level": "SPECIFIC_MEMBER",
  "usersWithAccess": [
    {
      "userEmail": "sam@acme.com",
      "userId": "uB7nT2wQ9k",
      "accessLevel": "WRITE"
    }
  ],
  "errors": []
}
```

---

## Get sharing details

**POST** `/agents/get-sharing-details`

Returns the agent's current sharing configuration and the calling user's own
access level.

### Request parameters

- `agentId` (string, required) — The agent to inspect.

### Response

- `sharingLevel` (string) — `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `companyPermissionLevel` (string) — Access level granted company-wide, when `sharingLevel` is `COMPANY`.
- `sharedWith` (array<UserShare>) — Per-user grants: `userEmail`, `userId`, `accessLevel`.
- `userAccessLevel` (string) — The calling user's effective access level.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/get-sharing-details \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "sharingLevel": "SPECIFIC_MEMBER",
  "companyPermissionLevel": null,
  "sharedWith": [
    {
      "userEmail": "sam@acme.com",
      "userId": "uB7nT2wQ9k",
      "accessLevel": "WRITE"
    }
  ],
  "userAccessLevel": "ADMIN",
  "errors": []
}
```

---

## Transfer ownership

**POST** `/agents/transfer-ownership`

Transfers the agent to another member of the company. Only the **current
owner** may call this, and the new owner must already have some access to
the agent (share it with them first).

### Request parameters

- `agentId` (string, required) — The agent to transfer.
- `newOwnerId` (string, required) — User ID of the new owner. Must be a member of the company with existing access to the agent.

### Response

- `errors` (array<string>) — Error messages, if any occurred (for example `"New owner does not have access to agent yet."`).

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/transfer-ownership \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "V1StGXR8Z5",
    "newOwnerId": "uB7nT2wQ9k"
  }'
```

```json title="Response"
{
  "errors": []
}
```

---

## Generate an audio upload link

**POST** `/agents/generate-audio-upload-link`

Returns a pre-signed S3 URL for uploading a WAV audio file. Upload the file
with an HTTP `PUT` to `uploadUrl`, then reference the returned `s3Uri`
wherever an audio input is accepted.

### Request parameters

None — send an empty object `{}` (WAV format is currently fixed).

### Response

- `uploadUrl` (string) — Pre-signed URL; `PUT` the file bytes here with `Content-Type: audio/wav`.
- `s3Uri` (string) — Key of the uploaded file. Pass it as `s3Uri` in the matching input.
- `expiresInSeconds` (integer) — How long the upload URL stays valid.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/generate-audio-upload-link \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

# Then upload the file:
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: audio/wav" \
  --data-binary '@recording.wav'
```

```json title="Response"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-audio/...",
  "s3Uri": "temp/audio/1024/8f3a2b7c.wav",
  "expiresInSeconds": 3600,
  "errors": []
}
```

---

## Generate an image upload link

**POST** `/agents/generate-image-upload-link`

Returns a pre-signed S3 URL for uploading an image.

### Request parameters

- `fileExtension` (string) — `"png"`, `"jpg"`, or `"jpeg"`. Defaults to `"png"`.

### Response

- `uploadUrl` (string) — Pre-signed URL; `PUT` the file bytes here.
- `s3Uri` (string) — Key of the uploaded file. Pass it as `s3Uri` in the matching input.
- `mimeType` (string) — MIME type to send as `Content-Type` on the upload.
- `expiresInSeconds` (integer) — How long the upload URL stays valid.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/generate-image-upload-link \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "fileExtension": "png" }'
```

```json title="Response"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-images/...",
  "s3Uri": "temp/images/1024/2b7c9d1e.png",
  "mimeType": "image/png",
  "expiresInSeconds": 3600,
  "errors": []
}
```

---

## Generate a file upload link

**POST** `/agents/generate-file-upload-link`

Returns a pre-signed S3 URL for uploading an arbitrary document.

### Request parameters

- `fileExtension` (string) — File extension, for example `"pdf"`, `"docx"`, `"txt"`.

### Response

- `uploadUrl` (string) — Pre-signed URL; `PUT` the file bytes here.
- `s3Uri` (string) — Key of the uploaded file. Pass it as `s3Uri` in the matching input.
- `mimeType` (string) — MIME type to send as `Content-Type` on the upload.
- `expiresInSeconds` (integer) — How long the upload URL stays valid.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/agents/generate-file-upload-link \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "fileExtension": "pdf" }'
```

```json title="Response"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-files/...",
  "s3Uri": "temp/files/1024/9d1e4a6f.pdf",
  "mimeType": "application/pdf",
  "expiresInSeconds": 3600,
  "errors": []
}
```

---

## Errors

| Status | When |
|--------|------|
| `200` | Success — check `errors` for validation messages (blank name/description on create, missing `versionToRollback`, conversation not found). |
| `401` | The linked user lacks the required access level (see the [access table](#versioning-and-access-levels)), or is not the owner for `transfer-ownership`. |
| `403` | Scoped key without the endpoint in its allow-list. |
| `422` | `SENSITIVE_TOOL_NOT_AGENT_ATTACHABLE`: a tool with [sensitive output](/docs/guide/agentic/tools.md#sensitive-output) can't be attached to an agent. |
| `408` | Server-side error; `errors` contains the message. |

---

## Related

- [Poweruser API overview](/docs/api/poweruser.md)
- [Tools (Poweruser API)](/docs/api/poweruser/tools.md)
- [Managers (Poweruser API)](/docs/api/poweruser/managers.md)
- [Agents guide](/docs/guide/agentic/agents.md)
- [Versions guide](/docs/guide/agentic/versions.md)

