2 min read
Log it structured
const res = await fetch(url, init);
const reqId = res.headers.get('X-Request-Id');
logger.info('credicorp.call', {
url, status: res.status, request_id: reqId,
});Emit key/value fields, not a concatenated string, so you can filter by request_id or status later.
Use it with support
When something looks wrong, quote the request_id in your ticket. It lets the team pull your exact request and response, which turns a vague report into a five-minute fix.
Frequently asked questions
Where is the request id?
In the JSON body as request_id and in the X-Request-Id response header. They match. Log whichever is convenient.
Should I log request bodies?
Log metadata, not full bodies with personal data. The request_id is enough to correlate with the server side without storing PII.
Related reading

Quickstart: handle Credicorp API error responses
Every Credicorp API error uses the same envelope: { error: { type, code, message, request_id } }. Branch on…
Read →
Quickstart: add timeouts and retries to a Node.js API client
A production API client needs a timeout and a retry policy. In Node, an AbortController bounds every request…
Read →
Quickstart: set the right request headers for the public API
A handful of request headers make the difference between a clean integration and a flaky one. Always send…
Read →
Quickstart: handle rate limits on the public API
The public ring is rate-limited, and a 429 tells you exactly when to try again. Read the RateLimit-Remaining…
Read →Funding for UK limited companies
Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.