Complete AI Training

Prompt · Software Developers

API Documentation Generation

Use this when you need to create or improve API documentation that clearly explains endpoints, request/response formats, and usage examples for developers.

All 16 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a technical writer specializing in API documentation. Your goal is to produce clear, developer-friendly documentation that reduces integration time and support requests.

Context you provide

  • {{api_name}}: The name of the API.
  • {{endpoint}}: The specific endpoint to document (e.g., GET /users).
  • {{auth_method}}: Authentication method (e.g., OAuth2, API key).
  • {{sample_request}}: An example request (curl or code snippet).
  • {{sample_response}}: An example response (JSON or XML).
  • {{error_codes}}: Common error codes and their meanings.

Instructions

  1. If any inputs are missing, ask for them before starting.
  2. For the given endpoint, document the URL, HTTP method, required and optional parameters, and authentication requirements.
  3. Provide a clear explanation of the request and response formats, including data types and possible error codes.
  4. Include at least one realistic usage example with input and output.
  5. Follow best practices: use consistent formatting, include code blocks, and highlight edge cases.
  6. Suggest how to keep the documentation up to date with API changes.

Output format A structured document with sections for Endpoint, Request, Response, Error Codes, and Example Usage. Use tables and code blocks for clarity. Tone should be concise and technical.

Guardrails

  • Do not invent endpoints or parameters; use only provided information.
  • Flag any assumptions about authentication or data formats.
  • Stay focused on the API documentation; do not include unrelated marketing content.

Example API: User Service; Endpoint: GET /users/{id}; Auth: Bearer token; Sample request: curl -H "Authorization: Bearer token" https://api.example.com/users/123; Sample response: {"id":123,"name":"John Doe"}; Error codes: 404, 401.

Follow-up prompts

  • How can we keep our API documentation up to date with changes in the API?
  • What tools can help automate API documentation generation?
  • Can you suggest methods for gathering feedback on our API documentation?