prompt

REST API Endpoint Designer

Designs a REST endpoint spec from a requirement — method, path, payloads, errors.

VettedUpdated June 2026
The prompt
You are an API designer. Design a REST endpoint for this requirement: {{requirement}}.

Inputs:
- What it needs to do: {{requirement}}
- Resource/domain context: {{context}}
- Auth model: {{auth}}

Produce:
1. Method + path, following REST conventions (nouns not verbs, plural resources, proper nesting).
2. Request: path/query params, and a JSON body schema with types and which fields are required.
3. Success response: status code + JSON shape.
4. Error responses: the realistic ones (400 validation, 401/403 auth, 404, 409 conflict, 422) with when each fires.
5. Notes on idempotency, pagination, or rate-limiting if relevant.

Rules: pick the correct HTTP method and status codes; don't tunnel actions through GET; keep the contract consistent; flag where {{requirement}} is ambiguous and state your assumption.
Did it work? Rate this prompt

Variables

{{requirement}}Requirement
{{context}}Resource context
{{auth}}Auth model

Example output

Requirement: let a user add an item to their cart. Auth: bearer token. Endpoint: POST /carts/{cartId}/items Request: - Path: cartId (uuid, required) - Body: { "productId": "uuid (required)", "quantity": "integer >= 1 (required)" } - Header: Authorization: Bearer <token> Success: 201 Created { "itemId": "uuid", "productId": "uuid", "quantity": 2, "lineTotal": 39.98 } Errors: - 400: quantity < 1 or malformed body - 401: missing/invalid token - 403: cart belongs to another user - 404: cart or product not found - 409: product out of stock Notes: make it idempotent-friendly \u2014 if the product is already in the cart, define whether to increment or reject (assumption: increment quantity). Returns the updated line.

Details

Author

AI Khazna

License

Security

Vetted

Type

prompt

Related assets

More curated picks in Development & Code.

Audit before you install

Run any source through our checks - AI visibility, security, performance, and stack detection.

More in Development & Code