PromptAIPromptAI
DemoPricingCommunityBlogPromptsLog inGet Started
Prompt library/Coding

API Documentation Prompt for Clear Docs

A structured prompt that documents your API endpoint — params, responses, errors, and examples — in clean reference style, with a real example.

Enhanced prompt — ready to use
ROLE
You are a senior technical writer with expertise in creating comprehensive and clear API documentation. Your goal is to produce well-structured, user-friendly documentation that enables developers to understand and effectively use the API.

TASK
Write thorough documentation for the user's API, including descriptions of endpoints, request and response formats, authentication methods, error handling, and example usage. Think through this step by step to ensure completeness and clarity.

CONTEXT
The user needs clear and detailed API documentation aimed at software developers who will integrate or interact with the API. The domain involves technical software interfaces and assumes readers have basic understanding of APIs.

REQUIREMENTS
- Include endpoint descriptions with HTTP methods and URLs.
- Provide details on required headers, parameters, and request body formats.
- Explain authentication mechanisms.
- Describe possible error responses with status codes.
- Provide sample requests and responses in code snippets.
- Follow best practices for API docs clarity and usability.
- Before finalizing, verify your answer for correctness and completeness.

OUTPUT FORMAT
A structured API documentation outline with headings and subheadings, supported by paragraphs and formatted code blocks for examples.

That's what PromptAI produced from this vague prompt: “write documentation for my api”

Example result

# User's API Documentation

Welcome to the User's API documentation. This document provides a detailed overview of the available endpoints, authentication methods, request and response formats, error handling, and sample usage examples. This API is designed to enable developers to efficiently integrate and interact with the system programmatically.

---

## Table of Contents

1. [Overview](#overview)  
2. [Authentication](#authentication)  
3. [Endpoints](#endpoints)  
   - [1. Get User Profile](#1-get-user-profile)  
   - [2. Create User](#2-create-user)  
   - [3. Update User](#3-update-user)  
   - [4. Delete User](#4-delete-user)  
4. [Error Handling](#error-handling)  
5. [Example Usage](#example-usage)  
6. [Contact and Support](#contact-and-support)  

---

## Overview

The User's API enables developers to manage and retrieve user information programmatically. All data is exchanged using JSON format over HTTP. The API follows RESTful principles to provide intuitive access patterns.

Base URL:  
```
https://api.example.com/v1
```  

---

## Authentication

### Method

The API uses **token-based authentication** with Bearer tokens. Every request (except for public or health check endpoints, if any) must include an `Authorization` header with a valid token.

### How to Use

1. Obtain an API token from your account dashboard or via the authentication service.
2. Include the token in the HTTP header as follows:

```
Authorization: Bearer YOUR_ACCESS_TOKEN
```

### Example

```http
GET /v1/users/123 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6...
Content-Type: application/json
```

---

## Endpoints

### 1. Get User Profile

Retrieve detailed information about a specific user.

- **URL:** `/users/{userId}`
- **Method:** `GET`
- **URL Parameters:**

| Parameter | Type   | Description                  | Required |
| --------- | ------ | ----------------------------| -------- |
| userId    | string | Unique identifier of the user| Yes      |

- **Headers:**

| Header          | Value                  | Required |
| --------------- | ---------------------- | -------- |
| Authorization   | Bearer access token    | Yes      |
| Content-Type    | application/json       | No       |

- **Success Response:**

  - **Status:** `200 OK`
  - **Content:**

  ```json
  {
    "id": "123",
    "username": "johndoe",
    "email": "johndoe@example.com",
    "created_at": "2023-01-15T10:00:00Z",
    "profile": {
      "first_name": "John",
      "last_name": "Doe",
      "age": 30
    }
  }
  ```

- **Error Responses:**

  - `401 Unauthorized` — Missing or invalid token.
  - `404 Not Found` — User with specified `userId` does not exist.

- **Example Request:**

```http
GET /v1/users/123 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1Ni...
```

---

### 2. Create User

Create a new user account in the system.

- **URL:** `/users`
- **Method:** `POST`
- **Headers:**

| Header          | Value                | Required |
| --------------- | -------------------- | -------- |
| Authorization   | Bearer access token  | Yes      |
| Content-Type    | application/json     | Yes      |

- **Request Body:**

```json
{
  "username": "johndoe",
  "email": "johndoe@example.com",
  "password": "strongPassword123",
  "profile": {
    "first_name": "John",
    "last_name": "Doe",
    "age": 30
  }
}
```

| Field      | Type   | Description                        | Required |
| ---------- | ------ | ---------------------------------| -------- |
| username   | string | Unique username                   |

How to adapt it

  • •Give it the endpoint, method, and a sample request/response for accurate docs.
  • •Ask for a copy-pasteable curl example alongside the reference.

Have your own rough prompt? Enhance it into a structured prompt like this in one click.

Enhance your own prompt

More coding prompts

Bash Script Prompt for Shell Automation
A structured prompt that writes a safe, portable Bash script for your task — with checks, comments, and a real example output.
Bug Fix Prompt That Finds Root Causes
A structured prompt that diagnoses and fixes a bug — root cause, the fix, and why it works — instead of a guess, with a real example.
Code Comment Prompt for Useful Comments
A structured prompt that adds clear, non-obvious comments and docstrings to your code — explaining why, not just what — with a real example.
Code Review Prompt for Better Feedback
A structured prompt that turns ChatGPT into a thorough code reviewer — bugs, edge cases, readability, and security — with a real example review.
Database Schema Prompt for Clean Data Models
A structured prompt that designs a normalized database schema for your app — tables, keys, and relations — with DDL and a real example.
Dockerfile Prompt for Production Images
A structured prompt that writes a secure, optimized Dockerfile for your app — multi-stage, small, and cache-friendly — with a real example.
PromptAIPromptAI

Transform your ideas into powerful, structured prompts with AI.

Product

  • Try Demo
  • Pricing
  • Chrome Extension
  • Blog
  • Prompts

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
Tools
Prompt Enhancer·ChatGPT Prompt Enhancer·ChatGPT Prompt Generator
For Devs
Prompt Enhancer for Cursor·Prompt Enhancer for Claude Code
Compare
AIPRM Alternative·PromptPerfect Alternative

© 2026 PromptAI. All rights reserved.