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 |
URL 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}"Example Response
{
"title": "AI Code Reviewer - Security & Performance",
"category": "Technology",
"tags": ["code-review", "debugging", "code-quality", "software-engineering"],
"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 stored prompt against your input. Provide the prompt's slug and a query. SpacePrompts retrieves the prompt and runs it through the default AI model, returning the generated response.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | No | The user message to send to the AI model |
URL 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": "Hey, can you send that over?"}'Example Response
{
"prompt": "Convert this sentence to formal business English.",
"query": "Hey, can you send that over?",
"result": "Could you please forward that document at your earliest convenience?"
}/token-countCount tokens for a given prompt and model using model-specific tokenizers.
URL 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}"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) |
URL 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": "Convert this sentence to formal business English."}'Example Response
{
"enhanced_prompt": "You are a professional business writing assistant. Rewrite the given sentence in formal business English, preserving the original meaning while using polite, professional, and concise language."
}Response Status Codes
| Code | Description |
|---|---|
200 | Successful response |
401 | Missing or invalid API key |
403 | API access requires a Pro or Team plan |
404 | Prompt not found |
429 | Rate limit exceeded — 60 requests/minute per API key |