Document APIs
Discover best practices, tools, and examples to help developers understand and use your APIs with confidence.
Discover best practices, tools, and examples to help developers understand and use your APIs with confidence.
Documentation is the first thing a developer sees and often the deciding factor in whether they adopt your API. Well-documented APIs reduce support requests, shorten integration time, and build trust. On the PSA Developer Portal, your documentation is generated directly from your OpenAPI specification, so the spec is the single source of truth.
Describe every API with an OpenAPI 3.0 or 3.1 document. A complete spec includes:
operationId.openapi: 3.0.3
info:
title: Orders API
version: 1.0.0
description: Create and manage customer orders.
servers:
- url: https://api.example.com/v1
paths:
/orders/{orderId}:
get:
operationId: getOrder
summary: Retrieve an order
description: Returns a single order by its unique identifier.
parameters:
- name: orderId
in: path
required: true
description: The unique identifier of the order.
schema:
type: string
responses:
"200":
description: The requested order.
"404":
description: No order exists with the given identifier.
Examples are often the most useful part of the documentation. Include a realistic request and response for each operation, and show both success and common error cases. Avoid real customer data; use clearly fictional values.
{
"id": "ord_1042",
"status": "shipped",
"total": 59.99,
"currency": "USD"
}
Explain how to get credentials and how to send them. Cover how to register an application, which scopes or permissions are required, how tokens are passed in requests, and how to handle expired or invalid credentials. Link to the Getting started page for the registration steps.
Use this checklist before publishing or updating an API:
operationId.Once your documentation is complete, move on to Publish APIs to make it available to developers.