---
title: "Create a prompt"
description: ""
---

<a id="playground-button:docs/apis/prompts/create-prompt"></a>

**POST** `https://api.respan.ai/api/prompts/`

## Servers

`https://api.respan.ai`: Respan API Server

<a id="request.auth"></a>

## Authentication

<a id="request.auth.Authorization"></a>

### RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer &lt;RESPAN_API_KEY&gt;. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -&gt; Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: `bearer`; format: `Respan API key`.


```http
Authorization: Bearer $RESPAN_API_KEY
```


**Or:**

### DashboardJwt

Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

HTTP scheme: `bearer`; format: `Dashboard JWT`.


```http
Authorization: Bearer $RESPAN_DASHBOARD_JWT
```


<a id="request"></a>

## Request body

A request body is required.

### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Required body | - |
| <a id="request.body.name"></a>`name` | `string` | Optional | Prompt name. Defaults to `Untitled`.<br />Example: `"customer_support"` |
| <a id="request.body.description"></a>`description` | `string` | Optional | Prompt description.<br />Example: `"Support chatbot prompt"` |


<details class="api-schema-source">
<summary>OpenAPI request schema</summary>


```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Prompt name. Defaults to `Untitled`.",
      "example": "customer_support"
    },
    "description": {
      "type": "string",
      "description": "Prompt description.",
      "example": "Support chatbot prompt"
    }
  }
}
```

</details>

<a id="response"></a>

## Responses

### 201

Prompt created successfully.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | Example: `{"id":"prompt_new123","name":"Customer Support Assistant","description":"Handles customer support queries with empathy","prompt_slug":"customer-support-assistant","tags":[],"current_version":null,"live_version":null,"created_at":"2026-01-21T12:00:00Z","updated_at":"2026-01-21T12:00:00Z"}` |
| <a id="response.body.id"></a>`id` | `string` | Optional | The unique prompt identifier. |
| <a id="response.body.name"></a>`name` | `string` | Optional | - |
| <a id="response.body.description"></a>`description` | `string or null` | Optional | - |
| <a id="response.body.prompt_slug"></a>`prompt_slug` | `string or null` | Optional | - |
| <a id="response.body.tags"></a>`tags` | `array<object>` | Optional | - |
| `tags[]` | `object` | Array item | - |
| `tags[].id` | `string` | Optional | - |
| `tags[].name` | `string` | Optional | - |
| `tags[].color` | `string` | Optional | - |
| `tags[].created_at` | `string` | Optional | Format: `date-time` |
| `tags[].updated_at` | `string` | Optional | Format: `date-time` |
| <a id="response.body.current_version"></a>`current_version` | `object or null` | Optional | The prompt's current version, as the full version object that Get a prompt version returns. |
| `current_version.version` | `integer` | Optional | - |
| `current_version.model` | `string` | Optional | - |
| `current_version.updated_at` | `string` | Optional | Format: `date-time` |
| <a id="response.body.live_version"></a>`live_version` | `object or null` | Optional | The deployed version, as the full version object that Get a prompt version returns. `null` until a version is deployed. |
| `live_version.version` | `integer` | Optional | - |
| `live_version.model` | `string` | Optional | - |
| `live_version.updated_at` | `string` | Optional | Format: `date-time` |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The unique prompt identifier."
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string",
      "nullable": true
    },
    "prompt_slug": {
      "type": "string",
      "nullable": true
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "current_version": {
      "type": "object",
      "nullable": true,
      "properties": {
        "version": {
          "type": "integer"
        },
        "model": {
          "type": "string"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "The prompt's current version, as the full version object that Get a prompt version returns."
    },
    "live_version": {
      "type": "object",
      "nullable": true,
      "properties": {
        "version": {
          "type": "integer"
        },
        "model": {
          "type": "string"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "The deployed version, as the full version object that Get a prompt version returns. `null` until a version is deployed."
    }
  },
  "example": {
    "id": "prompt_new123",
    "name": "Customer Support Assistant",
    "description": "Handles customer support queries with empathy",
    "prompt_slug": "customer-support-assistant",
    "tags": [],
    "current_version": null,
    "live_version": null,
    "created_at": "2026-01-21T12:00:00Z",
    "updated_at": "2026-01-21T12:00:00Z"
  }
}
```

</details>

<a id="response.error"></a>

### 400

Bad Request

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | - |
| `error` | `string` | Optional | Example: `"Validation error"` |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "example": "Validation error"
    }
  }
}
```

</details>

### 403

The API key is missing, invalid or expired.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | - |
| `detail` | `string` | Required in parent | - |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
```

</details>

##### Example


```json
{
  "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}
```


## OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

<!-- openapi-operation:start -->
<details class="api-schema-source">
<summary>OpenAPI operation</summary>


```json
{
  "summary": "Create a prompt",
  "operationId": "createPrompt",
  "tags": [
    "Prompts"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Prompt name. Defaults to `Untitled`.",
              "example": "customer_support"
            },
            "description": {
              "type": "string",
              "description": "Prompt description.",
              "example": "Support chatbot prompt"
            }
          }
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Prompt created successfully.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The unique prompt identifier."
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string",
                "nullable": true
              },
              "prompt_slug": {
                "type": "string",
                "nullable": true
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "color": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "current_version": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "version": {
                    "type": "integer"
                  },
                  "model": {
                    "type": "string"
                  },
                  "updated_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "description": "The prompt's current version, as the full version object that Get a prompt version returns."
              },
              "live_version": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "version": {
                    "type": "integer"
                  },
                  "model": {
                    "type": "string"
                  },
                  "updated_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "description": "The deployed version, as the full version object that Get a prompt version returns. `null` until a version is deployed."
              }
            },
            "example": {
              "id": "prompt_new123",
              "name": "Customer Support Assistant",
              "description": "Handles customer support queries with empathy",
              "prompt_slug": "customer-support-assistant",
              "tags": [],
              "current_version": null,
              "live_version": null,
              "created_at": "2026-01-21T12:00:00Z",
              "updated_at": "2026-01-21T12:00:00Z"
            }
          }
        }
      }
    },
    "400": {
      "description": "Bad Request",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "example": "Validation error"
              }
            }
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    }
  },
  "security": [
    {
      "RespanApiKey": []
    },
    {
      "DashboardJwt": []
    }
  ]
}
```

</details>
<!-- openapi-operation:end -->

<!-- openapi-path-item:start -->
<details class="api-schema-source">
<summary>OpenAPI path metadata</summary>


```json
{}
```

</details>
<!-- openapi-path-item:end -->

<!-- openapi-components:start -->
<details class="api-schema-source">
<summary>Referenced OpenAPI components</summary>


```json
{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "DashboardJwt": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Dashboard JWT",
      "description": "Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.",
      "x-fern-bearer": {
        "name": "dashboardJwt",
        "env": "RESPAN_DASHBOARD_JWT"
      }
    },
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}
```

</details>
<!-- openapi-components:end -->
