Documentation:
Prism API
Introduction
Overview
Welcome to Prism's official documentation! Whether you're just starting out or already an expert, this guide is designed to help you integrate our API into your code quickly and efficiently.
Prism is a REST API that features various endpoints, allowing developers to easily integrate utility tools into their own projects without breaking a sweat. Built on Cloudflare's powerful infrastructure, we are able to deliver near-instant results with a consistent uptime approaching 100%.
Quickstart
To get started, you will need API credentials. After completing your first checkout, you will be issued both a public and a secret API key. Once you have your keys, you can make requests to any of our endpoints using standard HTTP methods. Note that your secret key is used for authentication and should be kept secure.
Here is a simple example of a request to check for profanity using curl:
Authentication
Prism uses Bearer Token authentication. This means you must include your secret API key in the HTTP headers of every request you make.
API keys always start with the prefix sk_prism_ (secret key), or pk_prism (public key) followed by a unique identifier. You can obtain your credentials by purchasing credits. Once you receive your keys, store them securely; they will only be shown to you once. Also note that your API keys are permanently linked to the email address you provide at checkout.
To authenticate, add the following header to your request: Authorization: Bearer <YOUR_SECRET_API_KEY>
If your key is missing, invalid, or if you have insufficient credits, the API will return a 401 Unauthorized or 403 Forbidden error.
General Usage
Response Structure
Prism's endpoints use a unified response structure, returning clean and structured JSON data that is simple to parse in any environment. Each response is wrapped in a consistent object containing a status indicator, a descriptive message, relevant metadata like the credits used and remaining, and the requested data.
We strictly follow standard REST practices, using appropriate HTTP status codes (2xx for success, 4xx for client errors, 5xx for server errors) to ensure transparent communication with your application.
Every successful request returns this wrapper:
In the event of an error, the 'result' field is excluded:
Rate Limits
To ensure the security and stability of Prism, we enforce rate limits at multiple levels. These limits are designed to be generous enough for high-volume production apps while preventing abuse.
For user and server limits, you will receive a 429 Too Many Requests error following our standard error response wrapper. However, extreme traffic spikes will trigger our global edge protection.
| Level | Limit | Identified By | Error Response |
|---|---|---|---|
| User | 90 Requests/minute | X-Forwarded-For Header / API Key Used | 429 (JSON) |
| Server | 900 Requests/minute | API Key Used | 429 (JSON) |
| Global | 200 Requests/10 seconds | Incoming IP Address | 1015 (HTML) |
Forwarding User IPs
If you are calling Prism from your backend server, our API sees your server's IP address as a simple user by default. This means all your customers share the 90 reqs/min limit, which you might hit quickly depending on your traffic.
To avoid this, you can forward your user's IP address in the headers. Prism checks for the X-Forwarded-For header to identify unique users. If provided, the 90 reqs/min limit applies to that specific IP, while your server falls under the much higher 900 reqs/min limit.
Example header to pass individual user rate limits: "X-Forwarded-For": "203.0.113.195"
Important: You are strictly prohibited from sending fake or randomized IP addresses in this header to bypass rate limits. Abuse of this feature is easily detected and will result in the immediate and permanent revocation of your API key.
Billing
Prism operates on a prepaid credit system rather than a recurring subscription to ensure you never pay for idle time. One credit roughly equals one standard API execution, but more complex endpoints may cost more.
Credits are deducted from your balance immediately upon a successful request. If the request returns an error, the credits will be refunded for that request in the majority of cases. You only pay for successful results.
To buy credits, visit this page.
Credit Packs:
| Pack Name | Credits | Price (USD) | Cost per Credit |
|---|---|---|---|
| Tester | 1,000 | $1.99 | $0.002 |
| Indie | 5,000 | $4.99 | $0.001 |
| Venture | 20,000 | $14.99 | $0.00075 |
| Pro | 50,000 | $29.99 | $0.0006 |
| Business | 100,000 | $49.99 | $0.0005 |
| Enterprise | 400,000 | $119.99 | $0.0003 |
Costs of successful requests by endpoint:
| Endpoint | Cost/Request | Description |
|---|---|---|
| AI Matching | 2 - 35 credits | Order matches for a target text from a list of candidates. |
| Profanity Censor | 1 credit | Remove bad words from a text. |
| AI Moderator | 10 / 12 credits | Detect harmful content with context-aware AI. |
| Link Preview | 1 credit | Retrieve various content from a URL. |
| Avatar Generator | 1 credit | Generate seeded SVG profile icons. |
Endpoints
AI Matching
This endpoint evaluates the relationship between a target text and multiple candidates using vector embeddings, returning an ordered list with precise similarity scores. Perfect for intelligent search, categorization, or recommendation engines.
See documentationProfanity Censor
The profanity censor endpoint lets you input a text, and then returns a censored version of the original text. Multiple optional personalization options are available like a strictness level, censor style, a custom list of blacklisted words, and a custom list of whitelisted words.
See documentationAI Moderation
Leverage AI to detect unsafe content with deep context awareness. This endpoint assigns safety scores across 8 categories while adapting to the provided context. It can distinguish playful texts from genuine threats, ensuring accurate moderation for any environment.
See documentationLink Preview
The link preview endpoint allows you to easily extract a URL's metadata like its title, description, and cover image to help you generate rich link previews.
See documentationAvatar Generator
Generate unique SVG profile icons from any text seed. Easily customize character shapes, background patterns, border styles, and color palettes to perfectly match your design.
See documentation