Authentication
Authenticate requests to the Infracard Merchant API
API Key Authentication
All API requests must include your API key in the x-api-key header.
GET
/merchants/balanceExample authenticated request. All endpoints require the x-api-key header.
x-api-keyRequiredstringYour merchant API key, passed as a request header
curl -X GET https://api.infracard.co/merchants/balance \
-H "x-api-key: your-api-key"Getting Your API Key
API keys are issued through the Infracard merchant dashboard. Each key is scoped to a single merchant account.
Security Best Practices
- Never expose your API key in client-side code or public repositories
- Rotate keys regularly through the merchant dashboard
- Use environment variables to store keys in your application
- Restrict access to the key within your organization
Request Format
All requests must:
- Use HTTPS (HTTP requests are rejected)
- Include the
x-api-keyheader - Set
Content-Type: application/jsonfor request bodies
const response = await fetch('https://api.infracard.co/merchants/balance', {
headers: {
'x-api-key': process.env.INFRACARD_API_KEY!,
'Content-Type': 'application/json',
},
})Unauthorized Responses
Requests without a valid API key return a 401 Unauthorized response:
{
"statusCode": 401,
"message": "Unauthorized"
}