API Reference
Access your SpacePrompts prompts using your personal API key. Available on the Pro and Team plans.
Authentication
All requests must include your API key in the X-API-Key header. You can generate or view your API key from your Account Settings.
X-API-Key: {YOUR_API_KEY}Base URL
https://services.spaceprompts.com/api/v2Rate Limits
All endpoints are rate limited to 60 requests per minute per API key. Requests exceeding this limit will receive a 429 Too Many Requests response.
Endpoints
/prompts/{slug}Retrieve a prompt by its slug. Only returns prompts owned by the API key holder.
Path Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
slug | string | — | The unique slug of the prompt |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
response_format | string | json | Response format. Use text to return the system prompt as plain text only. |
Example Requests
JSON (default)
curl -X GET "https://services.spaceprompts.com/api/v2/prompts/{slug}" -H "X-API-Key: {YOUR_API_KEY}"JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/prompts/{slug}', {
headers: {
'X-API-Key': '{YOUR_API_KEY}',
},
})
const data = await response.json()
console.log(data.system_prompt)Text only
curl -X GET "https://services.spaceprompts.com/api/v2/prompts/{slug}?response_format=text" -H "X-API-Key: {YOUR_API_KEY}"JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/prompts/{slug}?response_format=text', {
headers: {
'X-API-Key': '{YOUR_API_KEY}',
},
})
const text = await response.text()
console.log(text)Example Response
{
"title": "AI Code Reviewer - Security & Performance",
"category": "Technology",
"tags": ["code-review", "debugging", "code-quality", "software-engineering"],
"system_prompt": "You are an expert code reviewer. Analyze the provided code and deliver a structured, actionable review focused on functionality, security, performance, and maintainability."
}/prompts/run/{slug}Run a prompt against the DeepSeek AI model. Uses the prompt's system_prompt as the system message and your query as the user message.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | The user message to send to the AI model |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
response_format | string | json | Response format. Use text to return the AI result as plain text only. |
Example Requests
JSON (default)
curl -X POST "https://services.spaceprompts.com/api/v2/prompts/run/{slug}" -H "X-API-Key: {YOUR_API_KEY}" -H "Content-Type: application/json" -d "{"query": "Target job title: Software Engineer Current role: Junior Developer with 2 years experience in React and Node.js"}"JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/prompts/run/{slug}', {
method: 'POST',
headers: {
'X-API-Key': '{YOUR_API_KEY}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: 'Target job title: Software Engineer Current role: Junior Developer with 2 years experience in React and Node.js',
}),
})
const data = await response.json()
console.log(data.result)Text only
curl -X POST "https://services.spaceprompts.com/api/v2/prompts/run/{slug}?response_format=text" -H "X-API-Key: {YOUR_API_KEY}" -H "Content-Type: application/json" -d "{"query": "Target job title: Software Engineer Current role: Junior Developer with 2 years experience in React and Node.js"}"JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/prompts/run/{slug}?response_format=text', {
method: 'POST',
headers: {
'X-API-Key': '{YOUR_API_KEY}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: 'Target job title: Software Engineer Current role: Junior Developer with 2 years experience in React and Node.js',
}),
})
const text = await response.text()
console.log(text)Example Response
{
"model": "deepseek-chat",
"result": "John Doe, [email protected]. Software Engineer with 2 years of experience building scalable web applications using React and Node.js. Proven ability to deliver high-quality code, optimize performance, and collaborate within agile teams."
}/token-countCount tokens for a given prompt and model using model-specific tokenizers.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The text to count tokens for |
model | string | Yes | One of: openai, claude, gemini, deepseek |
Supported Models
| Alias | Model |
|---|---|
openai | GPT-5.4 |
claude | Claude Sonnet 4.6 |
gemini | Gemini 3.1 Pro Preview |
deepseek | DeepSeek V3.2 |
Example Requests
curl -X GET "https://services.spaceprompts.com/api/v2/token-count?prompt=You+are+an+expert+code+reviewer&model=gemini" -H "X-API-Key: {YOUR_API_KEY}"JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/token-count?prompt=You+are+an+expert+code+reviewer&model=gemini', {
headers: {
'X-API-Key': '{YOUR_API_KEY}',
},
})
const data = await response.json()
console.log(data.token_count)Example Response
{
"model": "gemini",
"token_count": 9,
"character_count": 38
}/prompts/enhanceEnhance a prompt using AI. Analyzes the prompt for issues and returns an improved version. Uses the same enhancement quota as the dashboard.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The prompt text to enhance (max 3,000 characters) |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
response_format | string | json | Response format. Use text to return only the enhanced prompt as plain text. |
Example Requests
JSON (default)
curl -X POST "https://services.spaceprompts.com/api/v2/prompts/enhance" -H "X-API-Key: {YOUR_API_KEY}" -H "Content-Type: application/json" -d '{"prompt": "You are an expert code reviewer. Analyze the provided code and deliver a structured, actionable review focused on functionality,
security, performance, and maintainability."}'JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/prompts/enhance', {
method: 'POST',
headers: {
'X-API-Key': '{YOUR_API_KEY}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt: 'You are an expert code reviewer. Analyze the code and provide actionable feedback.',
}),
})
const data = await response.json()
console.log(data.enhanced_prompt)Text only
curl -X POST "https://services.spaceprompts.com/api/v2/prompts/enhance?response_format=text" -H "X-API-Key: {YOUR_API_KEY}" -H "Content-Type: application/json" -d '{"prompt": "You are an expert code reviewer. Analyze the provided code and deliver a structured, actionable review focused on functionality,
security, performance, and maintainability."}'JavaScript / TypeScriptconst response = await fetch('https://services.spaceprompts.com/api/v2/prompts/enhance?response_format=text', {
method: 'POST',
headers: {
'X-API-Key': '{YOUR_API_KEY}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt: 'You are an expert code reviewer. Analyze the code and provide actionable feedback.',
}),
})
const text = await response.text()
console.log(text)Example Response
{
"enhanced_prompt": "You are an expert code reviewer. Analyze the provided code and deliver a structured, actionable review focused on functionality, security, performance, and maintainability."
}Response Status Codes
| Code | Description |
|---|---|
200 | Successful response |
401 | Missing or invalid API key |
403 | API access requires a Pro plan |
404 | Prompt not found |
429 | Rate limit exceeded — 60 requests/minute per API key |