# createPrompt

```graphql
mutation CreatePrompt($projectReference: String!, $input: CreatePromptInput!) {
  createPrompt(projectReference: $projectReference, input: $input) {
    id
    name
    description
    content
    sourcePath
    source
    editMode
    sourceOnlyReasons
  }
}
```

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.

## Arguments

| Name                     | Type               | Required | Description                                                               |
| ------------------------ | ------------------ | -------- | ------------------------------------------------------------------------- |
| `projectReference`       | String!            | Yes      |                                                                           |
| `input`                  | CreatePromptInput! | Yes      |                                                                           |
| `input.id`               | String!            | Yes      | Becomes the file name and the prompt id.                                  |
| `input.description`      | String             |          |                                                                           |
| `input.content`          | String!            | Yes      |                                                                           |
| `input.sourceTargetKind` | WriteTargetKind    |          | The source to write; default project. One of `project`, `preview_branch`. |
| `input.targetBranchId`   | ID                 |          | Required with the kind preview\_branch.                                   |

## Variables

```json
{
  "projectReference": "string",
  "input": {
    "id": "a",
    "content": "string"
  }
}
```

## Responses

| Status | Description                             |
| ------ | --------------------------------------- |
| 200    | The PromptSource! in data.createPrompt. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation CreatePrompt($projectReference: String!, $input: CreatePromptInput!) {\n  createPrompt(projectReference: $projectReference, input: $input) {\n    id\n    name\n    description\n    content\n    sourcePath\n    source\n    editMode\n    sourceOnlyReasons\n  }\n}",
  "variables": {
    "projectReference": "string",
    "input": {
      "id": "a",
      "content": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createPrompt": {
      "id": "string",
      "name": "string",
      "description": "string",
      "content": "string",
      "sourcePath": "string",
      "source": "string",
      "editMode": "structured",
      "sourceOnlyReasons": [
        "string"
      ]
    }
  }
}
```
