SDKs // Python // Resources
client.usage
Last verified
Read Reverse Contact API credit balances and rate limits with client.usage.retrieve in Python, including request options, response fields and errors.
Read workspace credits, API key quotas and rate limits without spending credits.
| Method | Endpoint | Cost |
|---|---|---|
retrieve() | GET /v2/usage | Free. |
Calling conventions
Examples assume RC_API_KEY is set. Signatures show the published 0.3.0 synchronous methods. Use the same arguments with the Python async client.
models refers to reversecontact.types. NOT_GIVEN and NotGiven are the SDK's internal markers for omitted arguments. Leave these arguments out of your calls. For API body parameters, passing None sends an explicit null. Transport options use None to inherit their defaults. Timeout means a number of seconds or httpx.Timeout. Supply parameters marked Required to Python or to the API, even when the generated signature permits omission.
JSON response objects expose data, quotas, metadata and http_response. Check optional fields for None. See First call for the response envelope. CSV methods return text and iterators yield items.
HTTP failures raise an APIError subclass based on the response: BadRequestError, AuthenticationError, InsufficientCreditsError, PermissionDeniedError, NotFoundError, ConflictError, GoneError, UnprocessableEntityError, RateLimitError, DailyLimitError, KeyCreditLimitError, UnavailableForLegalReasonsError or InternalServerError. See the error mapping and retry rules.
retrieve
Check your quotas with client.usage.retrieve(). See the Usage endpoint for details.
Python SDK
def retrieve(
*,
timeout: Timeout | None = None,
max_retries: int | None = None,
headers: Mapping[str, str] | None = None,
**extra: object,
) -> Result[None]: ...Parameters
| Name | Type | Description |
|---|---|---|
timeout | Timeout | None | Optional. Seconds per HTTP attempt, or httpx.Timeout. Uses the client setting when None. |
max_retries | int | None | Optional. Retries after the first HTTP attempt. Uses the client setting when None. |
headers | Mapping[str, str] | None | Optional. Additional HTTP headers for this call. |
**extra | object | Optional. Additional API keyword arguments, including camelCase aliases, passed through to the API. |
Returns
Result[None]. data is None. Read quotas for credits and rate limits, and metadata for request diagnostics.
Errors
APIError subclasses follow the HTTP mapping above. APIConnectionError reports transport failures. APITimeoutError reports timed-out attempts. ReverseContactError covers invalid SDK options. Malformed typed response data can raise Pydantic ValidationError.
Example
Python SDK
from reversecontact import ReverseContact
with ReverseContact() as client:
result = client.usage.retrieve()
if result.quotas and result.quotas.workspace and result.quotas.workspace.credits:
print(result.quotas.workspace.credits.left)Related guides
See the Python SDK overview, First call and Client options.
FAQ
Does checking usage cost credits?
client.usage.retrieve() returns account quotas and costs 0 credits.
Why is data None in the Python usage response?
The Usage endpoint returns account information in quotas. That is why client.usage.retrieve() returns data as None.
How do I read my remaining credits in Python?
Read result.quotas.workspace.credits.left after checking that quotas, workspace and credits are present.