Skip to main content
The Prompts API allows you to manage AI prompts in the Swarms marketplace. You can create new prompts, update existing ones, and query prompts with various filters.

Authentication

All prompt management endpoints require authentication using one of the following methods:
  • API Key: Include your API key in the Authorization header as Bearer <your-api-key>
  • Supabase Session: Include your Supabase session token in the Authorization header

Base URL


Create Prompt

Create a new prompt in the marketplace.

Endpoint

Input schema (Add Prompt)

Request Body (detailed)

string
required
The name of the prompt (minimum 2 characters)
string
required
The prompt content (minimum 5 characters)
string
A detailed description of what the prompt does and when to use it
array
required
An array of use cases demonstrating the prompt’s applications
string
required
Comma-separated tags (minimum 2 characters)
boolean
default:"true"
Whether the prompt is free or paid
number
Price in USD (required if is_free is false, minimum: 0.01)
string
The category of the prompt (e.g., “content”, “code”, “analysis”)
string
default:"pending"
The status of the prompt (pending, approved, rejected)
string
Public image URL (valid URL or empty string)
string
Storage path for image (alternative to image_url)
string
Base64-encoded image (alternative to image_url; can include data:image/...;base64, prefix)
Links: array of strings or { "name": string, "url": string } (e.g. website, twitter, telegram for token metadata)
string
Seller wallet address
boolean
Enable tokenization on Solana
string
Required when tokenized_on is true; uppercase letters and numbers only; max 10 characters
string
Creator wallet public key; required when tokenized_on is true
string
Private key for signing (JSON array or base64); required when tokenized_on is true

Validation rules

  • Paid prompts: When is_free is false, price_usd is required and must be > 0.
  • Tokenization: When tokenized_on is true, ticker, creator_wallet, and private_key are required; ticker must be uppercase alphanumeric, max 10 characters.

Success response (200)

When tokenization is used, tokenized is true and token_address and pool_address are set.

Output schema (Add Prompt — success)

Error responses (Add Prompt)

  • 400 – Validation: error, message, details, errors, status_code. Content validation: also trustworthiness, contentQuality. Duplicate: existingId. Tokenization failed: standard 400 shape.
  • 401error, message, details, how_to_get_key, status_code (e.g. API key missing, invalid/expired, user not found).
  • 429error, message, details, currentUsage, limits, resetTime, status_code.
  • 500 – Server/database/tokenization error: error, message, details, status_code (may include hint, code for DB errors).

Error output schema (common fields)

Example Request


Update Prompt

Update an existing prompt in the marketplace.

Endpoint

Request Body

All fields from the create prompt endpoint are available, plus:
string
required
The unique identifier of the prompt to update

Response

Example Request


Query Prompts

Search and filter prompts in the marketplace.

Endpoint

Request Body

Search query to match against prompt names and descriptions (max 100 characters)
string
Filter by category (case-insensitive, max 50 characters)
string
default:"all"
Filter by price type: “all”, “free”, or “paid”
string
Filter by specific user ID
string
default:"newest"
Sort order: “newest”, “oldest”, “popular”, or “rating”
number
default:"6"
Number of results to return (min: 1, max: 100)
number
default:"0"
Number of results to skip for pagination (min: 0)

Response

Example Request

Query Parameters Explained

  • search: Searches in both the prompt name and description fields
  • category: Filters results to only show prompts in the specified category
  • priceFilter:
    • 'all': Shows both free and paid prompts
    • 'free': Shows only prompts where is_free is true
    • 'paid': Shows only prompts where is_free is false
  • sortBy:
    • 'newest': Sorts by creation date, newest first
    • 'oldest': Sorts by creation date, oldest first
    • 'popular': Sorts by popularity metrics
    • 'rating': Sorts by average user rating

Rate Limiting

All prompt management endpoints are subject to rate limiting:
  • Daily Limit: 500 prompts per user per day
  • Reset Time: Midnight UTC
  • Free Content Limit: 500 free prompts per day
  • Paid Content Limit: 500 paid prompts per day
When the rate limit is exceeded, you’ll receive a 429 error response:

Error Responses

The API returns standard HTTP status codes:
  • 200: Success
  • 400: Bad Request (validation errors)
  • 401: Unauthorized (authentication required)
  • 403: Forbidden (content validation failed)
  • 404: Not Found
  • 429: Too Many Requests (rate limit exceeded)
  • 500: Internal Server Error

Example Error Response

All endpoints return consistent error responses:
Validation errors may include details, errors, and status_code. Duplicate content responses include existingId. Rate limit (429) responses include currentUsage, limits, and resetTime. Authentication (401) responses may include how_to_get_key.

Common Validation Errors

  • Prompt name less than 2 characters
  • Prompt content less than 5 characters
  • Invalid URL format for image_url or links
  • Missing price_usd when is_free is false
  • Invalid use case format (missing title or description)
  • Duplicate content: response includes existingId with the existing prompt ID
  • Tokenization: when tokenized_on is true, missing or invalid ticker, creator_wallet, or private_key

Content Validation

All prompts undergo automatic validation for:
  • Duplicate Detection: Same prompt content for the same user returns 400 with existingId
  • Quality Assessment: Evaluates prompt clarity and completeness (responses may include trustworthiness, contentQuality)
  • Content Safety: Ensures prompts don’t contain harmful or inappropriate content
  • Trustworthiness Scoring: Assigns a score based on various quality factors
Prompts that fail validation will receive a 403 Forbidden or 400 Bad Request response with details about the validation failure.

Validation Response Example (duplicate)


Price Conversion

When you submit a prompt with price_usd, the system automatically converts it to SOL (Solana) based on the current market price. The converted price is stored in the price field. Example:
  • You set price_usd: 10.00
  • Current SOL price: $200
  • Calculated price: 0.05 SOL
This conversion happens automatically and is transparent to the user.

Database Schema

Prompts are stored with the following key fields:

Using Marketplace Prompts with Agents

Once you have a prompt in the marketplace, you can use it with any agent by specifying the marketplace_prompt_id in the agent configuration. The Swarms API will automatically retrieve the prompt from the marketplace and apply it to your agent.

How It Works

  1. Query the marketplace to find a suitable prompt using the Query Prompts endpoint
  2. Copy the prompt’s id from the response
  3. Use the marketplace_prompt_id field in your agent configuration
  4. The system automatically retrieves and applies the prompt to your agent

Example: Using a Marketplace Prompt

Direct Usage with Known Prompt ID

If you already know the prompt ID, you can use it directly:

Important Notes

  • When marketplace_prompt_id is provided, it takes precedence over the system_prompt field
  • The prompt is automatically retrieved from the marketplace and applied to the agent
  • You don’t need to manually fetch or pass the prompt content
  • Both free and paid marketplace prompts can be used with agents
  • For more details on agent configuration, see the Agent Completions Reference