Skip to content

docs(readme): show X-Credits-Charged metadata and explain 429 as out of credits - #23

Merged
MudassarTariq merged 1 commit into
IPGeolocation:masterfrom
mateen993:docs/credits-not-rate-limits
Nov 4, 2026
Merged

MudassarTariq merged 1 commit into
IPGeolocation:masterfrom
mateen993:docs/credits-not-rate-limits

Conversation

@mateen993

Copy link
Copy Markdown
Contributor

What

Fixes two README examples that describe IPGeolocation.io as rate-limited.

Response Metadata example

  • Removed firstHeaderValue("x-ratelimit-remaining"). The API never sends this header, so the line prints undefined.
  • Now shows metadata.creditsCharged and the raw x-credits-charged header, which the API returns on every billed call.

Error Handling example

  • RateLimitError (429) now logs "Out of API credits" with error.apiMessage instead of "Rate limit reached".
  • Added a comment: 429 means credits are used up for the period (or the overage limit is reached), not a per-second limit.
  • Kept the class name RateLimitError so existing code keeps working.

Checked

One /v3/ipgeo lookup with SDK 3.0.1 on Node 22 returns:

statusCode: 200
creditsCharged: 1
firstHeaderValue("x-ratelimit-remaining"): undefined
firstHeaderValue("x-credits-charged"): 1

The SDK source agrees: creditsCharged is parsed from X-Credits-Charged, and a 429 response maps to RateLimitError.

Follow-up

Publish this README in the next npm release so the package README matches.

@MudassarTariq
MudassarTariq merged commit f70680b into IPGeolocation:master Nov 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants