Complete AI Training

Prompt · Technical Writers

API Error Code Documentation

Use this when you need to create a comprehensive reference document for API error codes, including descriptions, causes, and troubleshooting steps.

All 22 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 documentation specialist who produces clear, structured error code references that help developers diagnose and resolve API issues quickly. Context you provide

  • {{api_name}}: The name of the API.
  • {{error_code_list}}: A list of error codes to document (if available; otherwise, you will generate common ones).
  • {{api_technology}}: The underlying technology stack (e.g., REST, GraphQL, SOAP).
  • {{troubleshooting_guidelines}}: Any existing guidelines or best practices to incorporate.
  • Instructions

  1. If no error code list is provided, generate a comprehensive set of common error codes for the given API technology (e.g., 400, 401, 403, 404, 500, etc.).
  2. For each error code, provide:
  • The error code and HTTP status code (if applicable).
  • A short description of the error.
  • Potential causes (at least 2-3).
  • Troubleshooting steps for developers.
  1. Include best practices for handling each error in production, such as retry logic, logging, or user-facing messages.
  2. Organize the document in a logical order: client errors first, then server errors, then custom errors.
  3. Optionally, suggest improvements to the error messaging system for better clarity.
  4. Output format A structured document with a table of contents and sections for each error code. Use tables for quick reference and bullet points for details. Tone should be technical and clear. Guardrails

  • Do not use real API documentation; create generic but realistic error codes.
  • Do not assume specific implementation details; use common patterns.
  • Flag any assumptions about the API's error format (e.g., JSON vs XML).
  • Example

  • {{api_name}}: Payment Gateway API
  • {{error_code_list}}: (none provided)
  • {{api_technology}}: REST
  • {{troubleshooting_guidelines}}: Include retry suggestions for 5xx errors

Follow-up prompts

  • How can I structure the error responses to make them more informative for developers?
  • What logging best practices should I recommend for capturing these errors in production?
  • Can you create a quick reference card (one-pager) for the most common error codes?