# Create prompt

```http
POST /projects/{project_reference}/prompts
```

Create a prompt source file in the project source or a preview branch so agents and clients can reuse its text; returns the prompt source document. Requires project.agents.write.

## Parameters

| Name                 | In    | Required | Description                                                                                          |
| -------------------- | ----- | -------- | ---------------------------------------------------------------------------------------------------- |
| `project_reference`  | path  | Yes      | Project slug, UUID, or domain that identifies the project.                                           |
| `source_target_kind` | query |          | Where to write the prompt file: project (the default) or preview\_branch. Other values are rejected. |
| `target_branch_id`   | query |          | Preview branch to use. Required for the preview\_branch target; rejected for any other target.       |

## Request body

| Field         | Type        | Required | Description                                                                                                                                           |
| ------------- | ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | string      | Yes      | Prompt id, also the name of its source file.                                                                                                          |
| `description` | string,null |          | Prompt description. Omit it or send null for none.                                                                                                    |
| `content`     | string      | Yes      | Prompt text.                                                                                                                                          |
| `source`      | string      |          | Complete prompt source file. It must export a structured prompt whose id matches id; when omitted the file is generated from description and content. |

## Responses

| Status | Description             |
| ------ | ----------------------- |
| 201    | Created prompt document |
| 400    | Bad request             |
| 401    | Unauthorized            |
| 403    | Forbidden               |
| 409    | Conflict                |
