Create prompt
You can create a prompt by sending a POST request to the prompts endpoint. The request should include the name of the prompt and an optional description.
After you created a prompt, you can create versions of the prompt by sending a POST request to the[ prompt versions endpoint](/api-reference/develop/prompts/prompt-versions/create-prompt-version).
- `name` *string* **required**: The name of the prompt.
- `description` *string*: Description of the prompt
```Python Python
url = "https://api.respan.ai/api/prompts/"
api_key = "YOUR_RESPAN_API_KEY" # Replace with your actual Respan API key
data = {
"name": "Your Prompt Name",
"description": "Your Prompt Description"
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
```
```TypeScript TypeScript
// Define the function with TypeScript
fetch('https://api.respan.ai/api/prompts/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_RESPAN_API_KEY'
},
body: JSON.stringify({
name: "Your Prompt Name",
description: "Your Prompt Description"
})
})
.then(response => response.json())
.then(data => console.log(data));
```
Authentication
AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys
Request
This endpoint expects an object.
name
The name of the prompt.
description
Description of the prompt
Response
Successful response for Create prompt
Errors
401
Unauthorized Error