Correios API

Tracking / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

Correios API provides integration with Brazil's national postal service, allowing you to calculate shipping costs, generate shipping labels, and track packages. It is essential for Brazilian e-commerce businesses that ship via the official postal network. Authentication requires credentials from a registered Correios business account.

💡

Beginner Tip

Correios uses a token-based auth system — first authenticate at the auth endpoint to get a JWT token, then use that token in subsequent API calls. Tokens expire, so build a refresh mechanism into your integration from the start.

Available Data

Correios data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Correios",
    "description": "Integration to provide information and prepare shipments using Correio's services",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

token JWT access token required for all subsequent API requests
expiraEm Token expiration datetime in ISO 8601 format
cartaoPostagem.numero The posting card number associated with this authentication session
cartaoPostagem.contrato Contract number linked to the posting card for billing purposes

Implementation Example

const url = "https://cws.correios.com.br/ajuda";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized on authentication Invalid Correios credentials or using personal account instead of business (cartao de postagem)
Use a valid business posting card (cartao de postagem) number and access code; personal accounts are not supported
Token expired error on API calls JWT tokens have a limited validity period and must be refreshed
Implement automatic token refresh when you receive a 401 response; re-authenticate and retry the original request
CEP not found error Querying an invalid or non-existent Brazilian postal code
Validate the CEP format (8 digits) before querying; use https://viacep.com.br as a fallback to verify CEP existence

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Tracking
Difficulty Intermediate
Verified: 2026-04-07

Similar APIs

View All →