# APIs.Dev > A few lines of code become a live, priced API that humans and agents can buy today. No plumbing tax. Links are relative; every page is Markdown at its URL plus `.md`. Docs MCP: `POST /mcp` (`search`, `fetch`, `check`, `plan`). Examples answer on `.apis.dev`; yours, on a free `.io.sb` Host, or from Launch your own domain. To build: write `definition.ts` from this file, `check` it until no Problems remain, then `npx apis.dev deploy`. Plans: Free 0 + 2%, Launch 25 + 1%, Team 99 + 0.5%, Scale 399 + 0.25% (USD a month + a share of your revenue: [/pricing.md](/pricing.md)). ## The file A Dataset API: given a Source that answers `{ website, headcount, industry }`, write ```ts import { define, secret } from 'apis.dev' /** Any company by its domain, with its headcount and sector. */ export default define({ name: 'companyfacts', domain: 'companyfacts.apis.dev', sources: { firms: { origin: 'https://firms.example.com', key: secret('FIRMS_KEY') }, }, Company: { domain: { type: 'url!#', from: 'firms', map: 'website' }, employees: { type: 'number?', from: 'firms', map: 'headcount' }, sector: { type: 'string?', from: 'firms', map: 'industry' }, }, offer: { 'Company.get': 0.002, 'Company.search': 0.005 }, }) ``` A Headless SaaS: given the records your Customers keep and a Deal's moves, write ```ts import { define } from 'apis.dev' /** A pipeline tracker your Customers log their deals in, each in its own space. */ export default define({ name: 'pipeline', domain: 'pipeline.apis.dev', Company: { name: 'string', domain: 'url!#', deals: '<-Deal.company', }, Deal: { title: 'string', amount: 'decimal(12,2)', company: '->Company.deals', stage: { open: [], qualify: 'opened', win: 'qualified', lose: ['opened', 'qualified'], }, }, offer: { Free: { month: 0, seats: 1, includes: { 'Deal.open': 25 } }, Team: { month: 49, seats: 5, seat: 9, includes: { 'Deal.open': 1000 } }, 'Deal.open': 0.001, }, }) ``` A Function, an Agent and a Service API, each in its own `define()`: ```ts Company: { domain: 'url!#', score: code((c) => ({ score: c.domain.endsWith('.ai') ? 80 : 50 })), summarize: generative('Two sentences on what {domain} sells', { returns: { summary: 'string' } }), research: agentic('Find the head of sales at {domain}', { returns: { headOfSales: 'string' } }), verify: human('Call and confirm the head of sales', { returns: { confirmed: 'boolean' }, role: 'researcher' }), classify: escalate([generative('The sector {domain} sells into'), human('Pick the sector', { role: 'researcher', within: '24h' })], { returns: { sector: 'string' } }), }, Text: { translate: generative('Translate {text} into {to}', { input: { text: 'string', to: 'string' }, returns: { text: 'string' } }), }, offer: { 'Company.score': 0.001, 'Company.summarize': 0.02, 'Company.research': 0.5, 'Company.verify': 5, 'Company.classify': 0.04, 'Text.translate': 0.01, }, ``` ```ts sources: { inbox: { system: 'email', scope: 'customer' }, crm: { system: 'crm', scope: 'customer' } }, Meeting: { with: 'string', company: 'string', at: 'date', book: agentic('Book a meeting with the next lead in {crm}', { tools: ['inbox', 'crm'], returns: { meeting: 'string' } }), }, on: { 'every Mon, Wed, Fri 09:00': 'Meeting.book' }, offer: { 'Meeting.book': { per1000Tokens: 0.01, perMinute: 0.05 }, 'Meeting.get': 0, 'Meeting.list': 0, }, ``` ```ts Filing: { company: 'string', year: 'number', status: { order: [], draft: { in: 'ordered', run: workflow(async ($, filing) => { const { form } = await $.generative('Draft the annual report for {company}', filing, { returns: { form: 'string' } }) await $.human('Check the draft', { form }, { role: 'paralegal' }) return { form } }) }, sign: 'drafted', file: { in: 'signed', run: agentic('File the signed report with the state') }, accept: 'filed', reject: 'filed', }, }, on: { 'Filing.ordered': 'Filing.draft', 'Filing.signed': 'Filing.file' }, offer: { 'Filing.order': { price: 25, when: 'accepted', accept: 'customer', acceptWithin: '7d', remedy: 'redo' }, }, ``` Rules: - A Noun whose fields name a Source in `from` gets `get` by its `#` key and `search` by a field; a Noun your Customers write, or an Integration holds, gets create, get, list, update and delete. - A move enters its past-form state and writes that Event: `open` enters `opened` and writes `Deal.opened`; `win` enters `won`; `lose` enters `lost`. - Every Verb you write, a move, a Function or a machine event, has a price, a plan or an outcome, or the publish is refused; a generated Verb serves when one covers it. A plan covers the Verbs it leaves unpriced, and an outcome every Verb of its Thing. - `Noun.verb` becomes `verbNoun` over MCP and in the SDK, plural for a list: `Deal.open` is `openDeal`, `Company.search` is `searchCompanies`. - A Trigger names its Verb in full: `'Deal.won': 'Deal.kickoff'`. - A Verb that an `on` line starts and that names no `role` is internal: it serves no path, tool or command, and a direct call answers 404 `no_route`; while it runs, the Thing is in its activity state, `drafting`. Every key: [/reference/platform.md#the-file](/reference/platform.md#the-file). ## Write a definition 1. Pick the pattern by who writes each field: a Source, your Customer, a Function, an agent, or a Workflow to an outcome. 2. `import { define } from 'apis.dev'`, a `/** */` pitch, then `name` and `domain`. 3. Nouns and fields, each with a `/** */` description; mark the key `#`. 4. Verbs: lifecycle moves, and Functions with `returns`. 5. Sources, credentials as `secret()`, Triggers under `on`. 6. A price, a plan or an outcome for each Verb. ## Read in this order 1. [Home](/index.md) 2. [How APIs.Dev works](/how-it-works.md) 3. [Start a Dataset API](/quickstart/dataset-api.md) 4. [Start a Headless SaaS](/quickstart/headless-saas.md) 5. [Patterns](/patterns.md) 6. [Choose your pattern](/patterns/choose.md) 7. [Dataset API](/patterns/dataset-api.md) 8. [Headless SaaS](/patterns/headless-saas.md) 9. [Content](/patterns/content.md) 10. [Marketplace](/patterns/marketplace.md) 11. [Definition and compile](/definition.md) 12. [Branches, tests and review](/definition/changes.md) 13. [Canaries and gradual release](/definition/rollout.md) 14. [Early access and flags](/definition/flags.md) 15. [Identity, access and policy](/identity.md) 16. [Sign-in and sessions](/identity/sign-in.md) 17. [Org graphs](/identity/orgs.md) 18. [Model and records](/model.md) 19. [Types, rules and writes](/model/types.md) 20. [Query, search and analytics](/model/analytics.md) 21. [Data and Sources](/data.md) 22. [Connectors and apps](/data/connectors.md) 23. [Front an API you already run](/data/front.md) 24. [Runtime](/runtime.md) 25. [Limits, placement and recovery](/runtime/envelope.md) 26. [Off, read-only and maintenance](/runtime/switches.md) 27. [Workflow](/workflow.md) 28. [Work](/work.md) 29. [Engagements](/work/engagements.md) 30. [Rates and earned autonomy](/work/quality.md) 31. [Commerce](/commerce.md) 32. [The buy side](/commerce/buy-side.md) 33. [The open contract](/commerce/open-contract.md) 34. [How you get paid](/commerce/settlement.md) 35. [Agreements and price changes](/commerce/agreements.md) 36. [Plan changes and proration](/commerce/plan-changes.md) 37. [Price and offer variants](/commerce/experiments.md) 38. [Referral codes and affiliates](/commerce/referrals.md) 39. [Prices by country and region](/commerce/regions.md) 40. [Interfaces and distribution](/interfaces.md) 41. [The site, the portal and the docs](/interfaces/site-portal-docs.md) 42. [Agent calls, streams and bulk jobs](/interfaces/invocation.md) 43. [Locales](/interfaces/locales.md) 44. [The bar for generated pages](/interfaces/standards.md) 45. [Support for your Customers](/interfaces/support.md) 46. [Ask, answers from your docs](/interfaces/ask.md) 47. [Lead capture and the interest list](/interfaces/leads.md) 48. [Broadcasts](/interfaces/broadcasts.md) 49. [Legal pages and consent](/interfaces/legal.md) 50. [Ready actions in automation tools](/interfaces/automations.md) 51. [What every product gets](/every-product.md) 52. [Trust and operations](/trust.md) 53. [Your workspace](/trust/account.md) 54. [Client accounts under your brand](/trust/clients.md) 55. [A private deploy](/trust/private.md) 56. [The Verifier](/trust/verifier.md) 57. [Data governance](/trust/governance.md) 58. [Edge, model and tool security](/trust/security.md) 59. [Fraud and abuse](/trust/fraud.md) 60. [Alerts and on-call](/trust/alerts.md) 61. [Takedowns and trader rules](/trust/obligations.md) 62. [A product's life](/lifecycle.md) 63. [Bring an existing business](/lifecycle/import.md) 64. [What Customers keep](/lifecycle/continuity.md) 65. [Reference](/reference.md) 66. [The agent contract](/reference/contract.md) 67. [Platform reference](/reference/platform.md) ## Optional - [llms-full.txt](/llms-full.txt): every page in one file, in this order (256,660 tokens) - [definition.schema.json](/definition.schema.json): the file as JSON Schema