API template library

Simulate the Perplexity Sonar and Agent API

A WireMock simulation of Perplexity's REST API — covering Sonar chat completions (synchronous and async), the Agent API, the Search API, embeddings, decisions, skills, batch processing, and usage analytics.

Vendor
Perplexity
Functionality
Sonar, agents, search, embeddings
Spec version
1.0.0
Endpoints
35
Stubs
85
Protocol
REST
Validation
AI-validated Before publication, an AI agent exercised these endpoints against the real Perplexity API through WireMock's recording proxy, and the recorded traffic was used to verify each stub's request and response shapes.

Live sandbox · no signup, no API key

Perplexity API

A running WireMock Cloud instance of this template, callable right now from a terminal, a script, or an AI agent.

Base URL
https://r0k7om.wiremockapi.cloud

POST Create Agent Response

curl -s -X POST 'https://r0k7om.wiremockapi.cloud/v1/agent' \
  -H 'Content-Type: application/json' \
  -d '{}'

GET List Models

curl -s -X GET 'https://r0k7om.wiremockapi.cloud/v1/models'

POST Create Async Chat Completion

curl -s -X POST 'https://r0k7om.wiremockapi.cloud/v1/async/sonar' \
  -H 'Content-Type: application/json' \
  -d '{}'
Method Path Summary
POST /generate_auth_token Generate Auth Token
POST /revoke_auth_token Revoke Auth Token
POST /search Search the Web
GET /v1/admin/audit-events List audit events
POST /v1/agent Create Agent Response
GET /v1/agent/{id} Retrieve Agent Response
POST /v1/agent/{id}/cancel Cancel Agent Response
GET /v1/agent/{id}/files List Agent Response Files
GET /v1/agent/{id}/files/{file_id}/content Download Agent Response File
GET /v1/analytics/computer/usage Usage Analytics
GET /v1/async/sonar List Async Chat Completions
POST /v1/async/sonar Create Async Chat Completion
GET /v1/async/sonar/{api_request} Get Async Chat Completion
GET /v1/batches List batches
POST /v1/batches Create a batch
GET /v1/batches/{batch_id} Retrieve a batch
POST /v1/batches/{batch_id}/cancel Cancel a batch
POST /v1/contextualizedembeddings Create Contextualized Embeddings
POST /v1/decisions Answer questions
POST /v1/embeddings Create Embeddings
GET /v1/files List files
POST /v1/files Upload a file
DELETE /v1/files/{file_id} Delete a file
GET /v1/files/{file_id} Retrieve a file
GET /v1/files/{file_id}/content Download file content
GET /v1/models List Models
GET /v1/skills List skills
POST /v1/skills Create a skill
DELETE /v1/skills/{skill_id} Delete a skill
GET /v1/skills/{skill_id} Get a skill
PUT /v1/skills/{skill_id} Add a skill revision
GET /v1/skills/{skill_id}/download Get a skill download URL
GET /v1/skills/{skill_id}/revisions List skill revisions
POST /v1/sonar Create Chat Completion
GET /v2/analytics/computer/usage Usage Analytics per Member

Unauthenticated WireMock Cloud demo sandbox for Perplexity — not an official Perplexity sandbox, and it returns simulated example data only.

What's inside the Perplexity API template

The template covers Perplexity's API platform apart from the Orchestrator, which has a page of its own. A Sonar request answers with a chat.completion object whose usage block includes the search context size, plus citations and search results built around your question. The Agent API stores each response under a resp_ id, so a background run starts in_progress and reads back completed. Clients that render citations or poll for agent output follow the same code path they use in production.

  • Sonar — chat completions with citations, images and related questions on request, and reasoning models that add a think block
  • Async Sonar — requests that move from CREATED to IN_PROGRESS to COMPLETED across retrieves, with idempotency keys honoured
  • Agent API — responses with web-search and sandbox tools, background runs, cancellation, streaming and downloadable response files
  • Search, embeddings and decisions — ranked search results, base64 embeddings sized to the requested dimensions, and typed answers to decision questions
  • Skills and batches — versioned skill bundles with revision checks, and JSONL batch files validated line by line before a batch runs
  • Analytics and audit — usage buckets on the v1 and v2 analytics APIs, audit events, and auth token generation and revocation

Perplexity Sonar and Agent mock API FAQ

No search runs behind the mock. Answers, citations and search results follow a fixed pattern that quotes your question, which keeps assertions stable from one run to the next.

Each retrieve moves the job one step forward. An Agent API background run completes on its first retrieve, and an async Sonar request takes two to reach COMPLETED, so a polling loop finishes in a known number of calls without real waiting.

The Agent API does: stream set to true returns server-sent events, one text delta per word, ending in response.completed. Sonar ignores the flag and answers JSON, because Perplexity's spec documents only a JSON response for that route.

No. Vectors have the right length and encoding for the model and dimensions you request, but their values are random, so the same text gives a different vector each time. Use them to test storage and parsing, not ranking.

Vendor names identify APIs represented by WireMock template sources. This page does not imply vendor endorsement, certification, partnership, or official integration status.