Skip to content

API Specification Template

API Overview

Name: [API Name] Version: [Version number] Status: [Draft/Review/Approved/Deprecated]

Endpoint Specification

[Endpoint Name]

[HTTP Method] /api/v1/[endpoint-path]

Request

{
    "field1": "string",
    "field2": "number",
    "field3": {
        "nested": "object"
    }
}

Parameters

Name Type Required Description
field1 string Yes Description
field2 number No Description

Response

{
    "status": "success",
    "data": {
        "id": "string",
        "created": "timestamp"
    }
}

Status Codes

Code Description
200 Success
400 Bad Request
401 Unauthorized

Error Responses

{
    "status": "error",
    "code": "ERROR_CODE",
    "message": "Human readable message"
}

Authentication

  • Type: [Bearer Token/API Key/OAuth2]
  • Headers:
    Authorization: Bearer [token]
    

Rate Limiting

  • Rate: [requests/second]
  • Burst: [max burst]
  • Headers:
    X-RateLimit-Limit: [limit]
    X-RateLimit-Remaining: [remaining]
    

Example Usage

curl -X POST \
  https://api.example.com/v1/endpoint \
  -H 'Authorization: Bearer token' \
  -d '{
    "field1": "value"
  }'

Testing

  • Test Environment: [URL]
  • Mock Data: [Available/Not Available]
  • Test Credentials: [How to obtain]

Security Considerations

  • Authentication requirements
  • Data encryption
  • Input validation
  • Rate limiting

Monitoring

  • Metrics:
  • Response time
  • Error rate
  • Usage patterns
  • Alerts:
  • Threshold configurations
  • Alert channels