---
title: "Create an AI Agent for an app (v2, tenant actor)"
method: POST
path: "/v2/apps/{appId}/agents"
tags: ["Agents"]
---

# Create an AI Agent for an app (v2, tenant actor)

`POST /v2/apps/{appId}/agents`

## Request

- Base URL: `https://api.chat.ethora.com`
- URL: `https://api.chat.ethora.com/v2/apps/{appId}/agents`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Same body and response as `POST /v2/agents`, with the App in the path
as the agent's home App (`ownerAppId`) unless the body names another.
The caller must manage that App (403 `OWNER_APP_FORBIDDEN` otherwise).
Supports `User JWT` and `B2B Server JWT`; with a B2B Server JWT the
owner is the token's tenant App. Like `POST /v2/agents` it requires the
`ai` license feature and the account's agents capability.

## Path parameters

- `appId` string, required

## Request body

- object: Same fields as `POST /v2/agents`.

## Response `201`

```
{ ok: true, agent: Agent }
```

## Other responses

- `400`: ``` { error: 'Invalid flows script', code: 'FLOWS_INVALID', details: [{ path, message, line? }] } ```
- `401`: Unauthorized
- `403`: ``` { error: 'You do not manage the App named as ownerAppId', code: 'OWNER_APP_FORBIDDEN' } ```
- `404`: Not Found
- `422`: ``` { error: string, code: 'VALIDATION_ERROR' } ```
- `500`: Internal Server Error

---

[API](https://skmtc.dev/ethora/apis/platform-api.md) · [All operations](https://skmtc.dev/ethora/apis/platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ethora/apis/platform-api/revisions/01b6e64378ee?raw)
