api-to-example

api-to-example is a skill for Claude Code, Codex from surfmind-space/awesome-surfmind. It costs 75 tokens per session (607 once invoked), scanned A, original, MIT.

A helper that turns REST API documentation into a runnable request example, such as curl, fetch, or code in a chosen language. REST APIs are web services called with HTTP requests.

In plain words
What is it for?
Use it with endpoint documentation or an OpenAPI/Swagger specification to create a request and show expected responses and common errors.
Why use it?
It removes the guesswork around endpoints, authentication headers, request bodies, required fields, and secret placeholders.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/surfmind-space/awesome-surfmind/api-to-example
Any agent
npx skills add surfmind-space/awesome-surfmind --skill api-to-example
Clone the repo
git clone --depth 1 https://github.com/surfmind-space/awesome-surfmind

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-to-example

README.md
[![agentmods](https://agentmods.dev/badge/skills/surfmind-space/awesome-surfmind/api-to-example.svg)](https://agentmods.dev/skills/surfmind-space/awesome-surfmind/api-to-example)
Your own site
<a href="https://agentmods.dev/skills/surfmind-space/awesome-surfmind/api-to-example"><img src="https://agentmods.dev/badge/skills/surfmind-space/awesome-surfmind/api-to-example.svg" alt="Measured on agentmods" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 607 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00075 $0.00607
Opus 5 $0.00037 $0.00303
Sonnet 5 $0.00015 $0.00121
Haiku 4.5 $0.00007 $0.00061

Measured 4d ago against content hash d5a4a59af9a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-to-example scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

description: Turns REST API documentation into a runnable curl, fetch, or code example with required headers, request body, and placeholders for secrets. Use when the user wants to generate a request from API docs, an en
skills/api-to-example/SKILL.md · 45 lines

How it starts

The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API to Example

Turn the documented API endpoint into the smallest runnable example the user can paste and run — curl, fetch, or a language-specific snippet — complete with the required headers, request body shape, and placeholders for every secret. Work only from what the docs show; don't invent undocumented fields or claim a parameter is required when the docs don't say so.

  1. Extract the endpoint, method, auth scheme, required headers, parameters, request body schema, and the success response shape from the visible docs or OpenAPI/Swagger spec.
  2. Build the minimal example that would actually succeed, using placeholders like $API_KEY or <account-id> for secrets and private values.
  3. Verify the example carries every required header and parameter the docs list before presenting it; note any required field the docs leave unspecified.
  4. Add the expected response and the one or two errors a caller is most likely to hit (bad auth, missing field).

Return concise headings and include these sections when they fit: Runnable example, Required inputs, Expected response, Common mistakes. Preserve exact endpoint paths, header names, and field names. Be specific but don't overclaim; never include real secrets, and if the docs are incomplete, say what's missing and give the best supported example. Respond in the same language as the user's request.

Example

Docs (an endpoint that creates a charge):

POST /v1/charges — requires Authorization: Bearer <key>. Body: amount (integer, required), currency (string, required), description (string, optional).

Example:

Runnable example (curl):

curl https://api.example.com/v1/charges \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 2000, "currency": "usd", "description": "Test charge"}'

Required inputs: $API_KEY (secret bearer token); amount in the smallest currency unit; a supported currency code.

Expected response: 200 with the created charge object, including its id and status.

Common mistakes: Omitting Content-Type: application/json (the body is ignored); sending amount as a decimal instead of an integer; a stale key returns 401.

Read the full file on GitHub · 45 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 45 lines · 75 tokens per session scan A d5a4a59af9a0

Subscribe to this mod's changes

api-to-example is a skill published in the GitHub repository surfmind-space/awesome-surfmind (5 stars, last pushed 1mo ago), licensed MIT. It adds 75 tokens to every session and 607 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.