"Guide REST API integration including HTTP methods, authentication, error handling, and rate limiting. Use this skill when the user needs to connect to a third-party API, design an API client, troubleshoot API errors, or understand API concepts — even if they say 'connect to this API', 'why is the API returning errors', 'how do I authenticate', or 'build an API integration'.".
IRON LAW: Read the Docs, Then Build, Then Handle Errors
1. Read the API documentation completely (auth, endpoints, rate limits, errors)
2. Get a successful request working in isolation (curl/Postman)
3. Build error handling BEFORE building features
Skipping step 1 wastes hours on trial-and-error. Skipping step 3
creates fragile integrations that break silently in production.
HTTP Methods
Method
Purpose
Idempotent?
Example
GET
Read data
Yes
GET /users/123
POST
Create new resource
No
POST /users + body
PUT
Replace entire resource
Yes
PUT /users/123 + full body
PATCH
Update partial resource
Yes
PATCH /users/123 + partial body
DELETE
Remove resource
Yes
DELETE /users/123
Status Codes
Range
Meaning
Common Codes
2xx
Success
200 OK, 201 Created, 204 No Content
3xx
Redirect
301 Moved, 304 Not Modified
4xx
Client error (your fault)
400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests
5xx
Server error (their fault)
500 Internal, 502 Bad Gateway, 503 Service Unavailable
Authentication Types
Type
How It Works
When Used
API Key
Key in header or query param
Simple APIs, server-to-server
Bearer Token
Authorization: Bearer <token>
OAuth 2.0, JWT-based APIs
OAuth 2.0
Token exchange flow (authorize → token → API call)
Sandbox vs production: Most APIs have a sandbox/test environment. Build and test there first. Production API keys should never be in code.
Pagination: APIs return paginated results. Handle all pages, not just the first. Check for next_page token or offset parameter.
Webhook reliability: If using webhooks, implement idempotent handlers (same event received twice should not duplicate data). Store event IDs to deduplicate.
API changes break things: Pin to a specific API version. Subscribe to the provider's changelog/deprecation notices.
Secrets management: API keys and tokens NEVER in source code. Use environment variables or a secrets manager (AWS Secrets Manager, HashiCorp Vault).
References
For OAuth 2.0 flow details, see references/oauth-guide.md
For webhook implementation patterns, see references/webhook-patterns.md
1---2name: tech-api-integration3description: "Guide REST API integration including HTTP methods, authentication, error handling, and rate limiting. Use this skill when the user needs to connect to a third-party API, design an API client, troubleshoot API errors, or understand API concepts — even if they say 'connect to this API', 'why is the API returning errors', 'how do I authenticate', or 'build an API integration'.".4---56# REST API Integration Guide78## Framework910```11IRON LAW: Read the Docs, Then Build, Then Handle Errors12131. Read the API documentation completely (auth, endpoints, rate limits, errors)142. Get a successful request working in isolation (curl/Postman)153. Build error handling BEFORE building features1617Skipping step 1 wastes hours on trial-and-error. Skipping step 318creates fragile integrations that break silently in production.19```2021### HTTP Methods2223| Method | Purpose | Idempotent? | Example |24|--------|---------|------------|---------|25| GET | Read data | Yes | `GET /users/123` |26| POST | Create new resource | No | `POST /users` + body |27| PUT | Replace entire resource | Yes | `PUT /users/123` + full body |28| PATCH | Update partial resource | Yes | `PATCH /users/123` + partial body |29| DELETE | Remove resource | Yes | `DELETE /users/123` |3031### Status Codes3233| Range | Meaning | Common Codes |34|-------|---------|-------------|35| 2xx | Success | 200 OK, 201 Created, 204 No Content |36| 3xx | Redirect | 301 Moved, 304 Not Modified |37| 4xx | Client error (your fault) | 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests |38| 5xx | Server error (their fault) | 500 Internal, 502 Bad Gateway, 503 Service Unavailable |3940### Authentication Types4142| Type | How It Works | When Used |43|------|-------------|----------|44| **API Key** | Key in header or query param | Simple APIs, server-to-server |45| **Bearer Token** | `Authorization: Bearer <token>` | OAuth 2.0, JWT-based APIs |46| **OAuth 2.0** | Token exchange flow (authorize → token → API call) | User-delegated access (Google, FB) |47| **Basic Auth** | Base64(username:password) in header | Legacy, internal APIs |48| **HMAC Signature** | Sign request with secret key | Payment gateways, high-security |4950### Error Handling Strategy5152```53try:54 response = api.call(request)55 if response.status == 429: # Rate limited56 wait(response.headers['Retry-After'])57 retry()58 elif response.status >= 500: # Server error59 retry_with_backoff(max_retries=3)60 elif response.status >= 400: # Client error61 log_error(response.body)62 raise ClientError(response.body['message'])63 else:64 return response.json()65```6667### Rate Limiting6869| Strategy | How |70|----------|-----|71| Respect `Retry-After` header | Wait the specified seconds before retrying |72| Exponential backoff | Wait 1s, 2s, 4s, 8s between retries |73| Token bucket | Track request count, pause when approaching limit |74| Queue requests | Use a job queue (Celery, Bull) for high-volume integrations |7576### Integration Checklist77781. [ ] Read API documentation completely792. [ ] Test auth flow (get valid token/key)803. [ ] Test each endpoint with curl/Postman first814. [ ] Implement error handling for all status code ranges825. [ ] Implement rate limit handling836. [ ] Implement retry logic with backoff847. [ ] Log all requests and responses (redact secrets)858. [ ] Handle API versioning (pin to specific version)869. [ ] Set timeouts (connect: 5s, read: 30s)8710. [ ] Monitor for API deprecation notices8889## Output Format9091```markdown92# API Integration Plan: {API Name}9394## API Overview95- Base URL: {url}96- Auth: {type}97- Rate limit: {N requests/period}98- Documentation: {link}99100## Endpoints Used101| Endpoint | Method | Purpose | Auth |102|----------|--------|---------|------|103| {path} | GET/POST | {what it does} | {auth type} |104105## Error Handling106| Error | Response | Our Action |107|-------|----------|-----------|108| 401 | Unauthorized | Refresh token, retry |109| 429 | Rate limited | Backoff, retry after Retry-After |110| 500 | Server error | Retry 3x with exponential backoff |111112## Implementation Timeline113| Phase | Task | Duration |114|-------|------|----------|115| 1 | Auth + basic call | {days} |116| 2 | Full integration | {days} |117| 3 | Error handling + monitoring | {days} |118```119120## Gotchas121122- **Sandbox vs production**: Most APIs have a sandbox/test environment. Build and test there first. Production API keys should never be in code.123- **Pagination**: APIs return paginated results. Handle all pages, not just the first. Check for `next_page` token or `offset` parameter.124- **Webhook reliability**: If using webhooks, implement idempotent handlers (same event received twice should not duplicate data). Store event IDs to deduplicate.125- **API changes break things**: Pin to a specific API version. Subscribe to the provider's changelog/deprecation notices.126- **Secrets management**: API keys and tokens NEVER in source code. Use environment variables or a secrets manager (AWS Secrets Manager, HashiCorp Vault).127128## References129130- For OAuth 2.0 flow details, see `references/oauth-guide.md`131- For webhook implementation patterns, see `references/webhook-patterns.md`
Run npx skillmds@latest add charlieviettq/tech-api-integration in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
"Guide REST API integration including HTTP methods, authentication, error handling, and rate limiting. Use this skill when the user needs to connect to a third-party API, design an API client, troubleshoot API errors, or understand API concepts — even if they say 'connect to this API', 'why is the API returning errors', 'how do I authenticate', or 'build an API integration'.". It is listed under Integrations & APIs on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
charlieviettq (@charlieviettq) published this skill. Their other Agent Skills are listed on their SkillMD profile.