Documentation
Prompts API
Endpoints for retrieving, creating, updating, and deleting prompts.
GET List All Prompts
GET
/api/v1/prompts
Retrieve a list of all prompts, with optional filtering.
Query Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
category | string | Optional | Filter prompts by category | AI |
tags | string | Optional | Filter prompts by tags (comma-separated) | chatgpt,openai |
type | string | Optional | Filter prompts by type (static or dynamic) | dynamic |
user | string | Optional | Filter prompts by creator username | developer01 |
limit | number | Optional | Limit the number of results (default: 20, max: 100) | 10 |
offset | number | Optional | Offset for pagination (default: 0) | 20 |
sort | string | Optional | Sort by field (created_at, title) | created_at |
order | string | Optional | Sort order (asc, desc) | desc |
Example Response
200
JSON{
"status": "success",
"count": 2,
"total": 50,
"prompts": [
{
"id": 1,
"title": "Chatbot Prompts",
"content": "A collection of prompts for building advanced chatbots. Use these to create more engaging and helpful AI assistants that can handle a wide range of {{ topic }} queries and provide {{ tone }} responses.",
"category": "AI",
"tags": [
"chatgpt",
"openai"
],
"type": "dynamic",
"created_at": "2025-04-17",
"user": "developer01",
"providerCompatibility": [
"gpt-4",
"claude-2"
],
"difficulty": "intermediate"
},
{
"id": 4,
"title": "Code Review Checklist",
"content": "Use this checklist when reviewing code:\n\n1. Is the code well-documented?\n2. Are there appropriate unit tests?\n3. Does it follow our style guide?\n4. Are there any potential security vulnerabilities?\n5. Is error handling implemented correctly?\n6. Are there any performance concerns?\n7. Is the code DRY (Don't Repeat Yourself)?\n8. Are variable and function names descriptive?\n\nProvide specific examples and suggestions for improvement.",
"category": "Programming",
"tags": [
"code-review",
"best-practices"
],
"type": "static",
"created_at": "2025-04-12",
"user": "developer01",
"providerCompatibility": [
"gpt-3.5",
"gpt-4",
"claude-2"
],
"difficulty": "intermediate"
}
]
}
Example Request
BASH
curl -X GET "https://promptai.trymagic.xyz/api/v1/prompts?category=AI&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
GET Get a Specific Prompt
GET
/api/v1/prompts/:id
Retrieve a specific prompt by its ID.
Path Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id | string | number | Required | The ID of the prompt to retrieve | 1 |
Query Parameters (for Dynamic Prompts)
For dynamic prompts, you can provide variable values as query parameters. These will be used to process the prompt template.
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
[variable_name] | string | Optional | Value for the variable in the prompt | topic=AI&tone=friendly |
Example Response
200
JSON{
"status": "success",
"prompt": {
"id": 1,
"title": "Chatbot Prompts",
"content": "A collection of prompts for building advanced chatbots. Use these to create more engaging and helpful AI assistants that can handle a wide range of {{ topic }} queries and provide {{ tone }} responses.",
"category": "AI",
"tags": [
"chatgpt",
"openai"
],
"type": "dynamic",
"created_at": "2025-04-17",
"user": "developer01",
"providerCompatibility": [
"gpt-4",
"claude-2"
],
"difficulty": "intermediate",
"variables": [
"topic",
"tone"
]
}
}
Example Request
BASH
# Basic request
curl -X GET "https://promptai.trymagic.xyz/api/v1/prompts/1" \
-H "Authorization: Bearer YOUR_API_KEY"
# With dynamic variables
curl -X GET "https://promptai.trymagic.xyz/api/v1/prompts/1?topic=AI&tone=friendly" \
-H "Authorization: Bearer YOUR_API_KEY"
GET Search Prompts
GET
/api/v1/prompts/search
Search for prompts using a query string.
Query Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
query | string | Required | Search query string | chatbot |
limit | number | Optional | Limit the number of results (default: 20, max: 100) | 10 |
offset | number | Optional | Offset for pagination (default: 0) | 20 |
category | string | Optional | Filter search results by category | AI |
type | string | Optional | Filter search results by type (static or dynamic) | dynamic |
Example Response
200
JSON{
"status": "success",
"count": 1,
"total": 1,
"prompts": [
{
"id": 1,
"title": "Chatbot Prompts",
"content": "A collection of prompts for building advanced chatbots. Use these to create more engaging and helpful AI assistants that can handle a wide range of {{ topic }} queries and provide {{ tone }} responses.",
"category": "AI",
"tags": [
"chatgpt",
"openai"
],
"type": "dynamic",
"created_at": "2025-04-17",
"user": "developer01",
"providerCompatibility": [
"gpt-4",
"claude-2"
],
"difficulty": "intermediate"
}
]
}
Example Request
BASH
curl -X GET "https://promptai.trymagic.xyz/api/v1/prompts/search?query=chatbot&category=AI" \
-H "Authorization: Bearer YOUR_API_KEY"