Coding Workflows Workflow Intermediate

AI API Design Workflow

Design an API on its contract instead of discovering it endpoint by endpoint — model the resources, design the endpoints and payloads, pin the contract, then review it before code locks it in.

The problem

An API designed endpoint-by-endpoint as you code becomes a contract you can't change — clients depend on every accident, and the inconsistencies calcify into a permanent surface you maintain forever. The expensive decisions are made up front: what the resources are, how the endpoints map to them, what the payloads and validation rules look like, how errors and versions behave. 'Ask AI to write the endpoint' skips all of that and hands you the first plausible shape. This workflow designs the API as a contract first — resources, endpoints, payloads, versioning — and reviews it before code makes it permanent.

Recommended workflow

Each step uses an existing NewPrompt tool, pre-filled by a matching resource. Open the resource to read it, or jump straight into the tool with the inputs ready.

  1. Model the resources and boundaries

    Before endpoints, name the resources the API exposes and where its boundaries sit. Anchor the model as an architect so it reasons about the nouns and their relationships, not the first route that comes to mind.

    Outcome The API's resources and boundaries named, before any endpoint is drawn.
  2. Design the endpoints, payloads, and validation

    Work the design one decision at a time: which endpoints each resource needs, the request and response payloads, the validation rules, and how errors are shaped — consistently across the whole surface, not per-route improvisation.

    Outcome Endpoints, payload shapes, and validation rules decided deliberately and consistently.
  3. Pin the contract and versioning

    Turn the design into a precise contract — request and response schemas, error formats, and a versioning rule — so clients build against something stable instead of whatever the implementation happens to return.

    Outcome A precise request/response contract with a versioning rule, ready to build against.
  4. Review the design before it's code

    Run the design past a review lens — consistency across endpoints, error handling, breaking-change risk, missing validation — while it's still cheap to change, because once clients depend on it the contract is fixed.

    Outcome The API design reviewed for consistency and gaps before implementation locks it.

Expected outcome

An API designed as a contract before implementation — resources modeled, endpoints and payloads decided, request/response schemas and versioning pinned, and the whole surface reviewed for consistency — so you build against a deliberate design instead of hardening accidents into a contract clients can't escape.

Best for

  • Designing a new API surface before writing endpoints
  • Adding endpoints to an API without breaking its consistency
  • Pinning request/response contracts and a versioning rule up front

Not for

  • Designing the data model behind the API — use the AI Database Design Workflow
  • Deciding the system's overall architecture — use the AI Project Architecture Workflow
  • Documenting an API that already exists — describe the running endpoints instead

FAQ

AI API Design Workflow vs AI Project Architecture Workflow — which do I use?

Architecture decides the system's overall structure — services, boundaries, data flow. This workflow zooms into one surface: the API contract, walking resources, endpoints, payloads, versioning, and a design review. Set the architecture first, then run this to design the APIs that live inside it.

Should I design the API or the database schema first?

Design the API contract first with this workflow, then model the data behind it with the AI Database Design Workflow. The endpoints clients depend on and the tables they never see are distinct artifacts that inform each other — but let the contract you're committing to lead.

Does the AI design the API for me?

No. It structures the resource model, surfaces inconsistencies, and pressure-tests the contract so your design is deliberate. The API decisions — and the compatibility promises you make to clients — stay yours.

What deliverable does the AI API design workflow produce?

A pinned API contract: named resources and boundaries, endpoints with request and response payloads, validation rules, error formats, and a versioning rule — reviewed for consistency and gaps before code locks it. You build against this deliberate design instead of hardening accidents into a contract clients can't escape.

How do I run the AI API design workflow?

Work the four steps in your own AI tool: anchor an architect role to model resources and boundaries, design endpoints, payloads, and validation one decision at a time, pin the request/response schemas and versioning rule, then review the whole surface. NewPrompt supplies each step's prompt and links; you run them.

How do I validate an API contract before building it?

Step four runs the design past a review lens — consistency across endpoints, error handling, breaking-change risk, missing validation — while changes are still cheap. The prompt and API review checklist surface gaps, but confirming the contract is sound and safe to commit to clients is your call.

Part of these projects

Complete build journeys that include this workflow as a stage.

Guides for this workflow

Recommended next workflow

Tip: Each step's resource opens its tool pre-filled — start at step one and carry the output forward.