These API development prompts help you design, build, secure, test and document REST and GraphQL APIs: resource design, endpoints, validation, authentication, rate limiting, versioning, error handling and webhooks.
20 prompts on this page. Last updated: 4 December 2026. Written and tested by Saad Raza.
How to use these prompts
- Click Copy on any prompt.
- Paste it into ChatGPT, Claude, Gemini, Copilot or Perplexity.
- Replace everything in [square brackets] with your own details. The more specific you are, the better the answer.
- Read and edit the result before you use it. Add your own experience and check every fact, name and number.
Give the AI your language, version, framework and coding conventions, and paste the relevant code rather than describing it. Review, run and test every generated change before merging it, and never paste secrets, keys or private customer data into an AI tool.
Design
1. Design a REST API
Design a REST API for [application] with these resources: [list]. Give endpoints, HTTP methods, request and response examples, status codes, pagination and filtering.
2. Review an API design
Review this API design for consistency, naming, status codes, pagination, error format and versioning: [paste spec].
3. Design a GraphQL schema
Design a GraphQL schema for [domain] with types, queries, mutations and input types, avoiding over-fetching and N+1 problems: [describe].
4. Design error responses
Design a consistent error response format for our API, with error codes, messages, field-level validation errors and examples.
5. Plan API versioning
Compare URL, header and query-parameter versioning for [API], and plan how to deprecate old versions.
Building
6. Build an endpoint
Write a [framework] endpoint for [method and path] that [does what], with input validation, authorisation checks, error handling and tests.
7. Add input validation
Add request validation to this endpoint using [library], with clear error messages: [paste].
8. Add pagination
Add cursor-based pagination to this list endpoint and explain why it beats offset pagination for large datasets: [paste].
9. Build webhooks
Design and implement webhooks for [events]: payload format, signing secrets, retries with backoff and idempotency.
10. Make an endpoint idempotent
Make this POST endpoint safe to retry using idempotency keys: [paste].
Security
11. Add authentication
Implement [JWT, OAuth 2.0 or API keys] authentication for this API in [framework], including token expiry and refresh: [details].
12. Add rate limiting
Add rate limiting to this API per user and per IP, with correct headers and 429 responses: [paste or describe stack].
13. API security review
Review this API against the OWASP API Security Top 10, focusing on broken object-level authorisation, excessive data exposure and mass assignment: [paste].
14. Configure CORS correctly
Write a CORS configuration for this API that allows [origins] and methods safely, and explain each setting.
Performance and reliability
15. Add caching
Suggest caching for these endpoints, using HTTP cache headers, ETags or a cache like Redis, with invalidation rules: [paste].
16. Handle timeouts and retries
Write a client for [external API] with timeouts, retries with exponential backoff, and a circuit breaker.
17. Monitor an API
List metrics, logs and alerts to monitor for this API: latency, error rate, traffic and saturation, with suggested thresholds.
Docs and testing
18. Write OpenAPI docs
Generate an OpenAPI specification from this code: [paste routes and models].
19. Write API tests
Write automated tests for these endpoints covering success, validation, authentication and permission cases: [paste].
20. Write a Postman collection plan
List requests, environments and test scripts to include in a Postman collection for this API: [paste endpoints].
What are API development prompts?
API development prompts help you design REST and GraphQL APIs, build endpoints with validation and pagination, design error responses, add authentication and rate limiting, secure APIs against the OWASP API Security Top 10, add caching and webhooks, and write OpenAPI documentation and tests.
How to write better API development prompts
- Design before coding: agree resources, endpoints and error formats.
- Check authorisation everywhere: on every object, not just login.
- Be consistent: naming, status codes and pagination across all endpoints.
- Document as you build: keep the OpenAPI spec in sync.
Best AI tools to use with these prompts
Use ChatGPT or Claude to design and write endpoints, Postman or Insomnia to test APIs, Swagger or Redoc for documentation, and an API gateway for rate limiting and monitoring.
Frequently asked questions
REST or GraphQL?
REST is simpler and works well for most APIs and caching. GraphQL helps when clients need flexible queries across many related resources.
How do I secure an API?
Use strong authentication, check authorisation on every object, validate input, rate limit, use HTTPS, avoid exposing extra data and log suspicious activity.
Can AI design an API?
AI can propose designs, endpoints and specs quickly. Review them against your real use cases and security needs.
Can AI design an API?
AI can propose endpoints, schemas and specs quickly. Review them against your use cases, security needs and existing conventions.
What is the most common API security problem?
Broken object-level authorisation, where users can access data that belongs to others by changing an ID, is one of the most common.
More software development prompts
- Code Generation PromptsWrite functions, classes, scripts and boilerplate.
- Debugging PromptsFind and fix bugs, errors and performance problems.
- Code Review and Refactoring PromptsReview, clean up and improve existing code.
- Software Testing PromptsUnit, integration and end-to-end tests.
- Technical Documentation PromptsREADMEs, API docs, comments and guides.
- SQL and Database PromptsQueries, schema design, indexes and optimisation.
- DevOps PromptsCI/CD, Docker, cloud, monitoring and deployment.
- System Design and Architecture PromptsArchitecture, scaling, trade-offs and design reviews.
Back to all software development prompts or the full prompt library, including SEO prompts.
APIs power products. SEO powers growth. Request a free audit and I will show you what to fix first.
Request received
Thank you! Saad will contact you within the next 24 hours.
Keep an eye on your phone and inbox.
