> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://www.respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://www.respan.ai/docs/_mcp/server.

# Create a prompt

POST https://api.respan.ai/api/prompts/
Content-Type: application/json

Reference: https://www.respan.ai/docs/apis/prompts/create-prompt

## Authentication

- `Authorization` header (bearer token, required) — 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.
- `Authorization` header (bearer token, required) — Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

## Request

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional) — Prompt name. Defaults to `Untitled`.
- `description` (string, optional) — Prompt description.

## Response

### 201

Prompt created successfully.

- `id` (string, optional) — The unique prompt identifier.
- `name` (string, optional)
- `description` (string, optional, nullable)
- `prompt_slug` (string, optional, nullable)
- `tags` (list of ApiPromptsPostResponsesContentApplicationJsonSchemaTagsItems, optional)
- `current_version` (ApiPromptsPostResponsesContentApplicationJsonSchemaCurrentVersion, optional, nullable) — The prompt's current version, as the full version object that Get a prompt version returns.
- `live_version` (ApiPromptsPostResponsesContentApplicationJsonSchemaLiveVersion, optional, nullable) — The deployed version, as the full version object that Get a prompt version returns. `null` until a version is deployed.

## Errors

### 400 Bad Request Error

Bad Request

- `error` (string, optional)

### 403 Forbidden Error

The API key is missing, invalid or expired.

- `detail` (string, required)

## Types

### ApiPromptsPostResponsesContentApplicationJsonSchemaTagsItems

- `id` (string, optional)
- `name` (string, optional)
- `color` (string, optional)
- `created_at` (datetime, optional)
- `updated_at` (datetime, optional)

### ApiPromptsPostResponsesContentApplicationJsonSchemaCurrentVersion

The prompt's current version, as the full version object that Get a prompt version returns.

- `version` (integer, optional)
- `model` (string, optional)
- `updated_at` (datetime, optional)

### ApiPromptsPostResponsesContentApplicationJsonSchemaLiveVersion

The deployed version, as the full version object that Get a prompt version returns. `null` until a version is deployed.

- `version` (integer, optional)
- `model` (string, optional)
- `updated_at` (datetime, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "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"
}
```

**SDK Code**

```python
import requests

url = "https://api.respan.ai/api/prompts/"

payload = {}
headers = {
    "Authorization": "Bearer <respanApiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.respan.ai/api/prompts/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <respanApiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.respan.ai/api/prompts/"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <respanApiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.respan.ai/api/prompts/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <respanApiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.respan.ai/api/prompts/")
  .header("Authorization", "Bearer <respanApiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.respan.ai/api/prompts/', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <respanApiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.respan.ai/api/prompts/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <respanApiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <respanApiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.respan.ai/api/prompts/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```