Configuration Models
All configuration models use Pydantic v2 for validation.
OAuth2Config
Configuration for OAuth2 authentication.
from intapp_rest_client import OAuth2Config, OAuth2GrantType
config = OAuth2Config(
token_url="https://api.example.com/oauth/token",
client_id="your_client_id",
client_secret="your_secret",
grant_type=OAuth2GrantType.CLIENT_CREDENTIALS, # Default
scope="data",
token_refresh_margin=30 # Refresh 30s before expiry
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
token_url | str | (required) | OAuth2 token endpoint URL |
client_id | str | (required) | OAuth2 client ID |
client_secret | str | (required) | OAuth2 client secret |
grant_type | OAuth2GrantType | CLIENT_CREDENTIALS | Grant type |
scope | str | None | OAuth2 scope |
username | str | None | Username (for password grant) |
password | str | None | Password (for password grant) |
auth_url | str | None | Authorization URL (for auth code grant) |
redirect_uri | str | None | Redirect URI (for auth code grant) |
token_refresh_margin | int | 30 | Seconds before expiry to refresh |
Grant Types
from intapp_rest_client import OAuth2GrantType
OAuth2GrantType.CLIENT_CREDENTIALS # Default, for service-to-service
OAuth2GrantType.PASSWORD # For user credentials
OAuth2GrantType.REFRESH_TOKEN # Token refresh
OAuth2GrantType.AUTHORIZATION_CODE # Interactive OAuth flowJWTConfig
Configuration for JWT token generation.
from intapp_rest_client import JWTConfig
config = JWTConfig(
secret_key="your-secret-key",
algorithm="HS256",
token_lifetime=3600,
issuer="my-service",
audience="api.example.com",
custom_claims={"user_id": 123}
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
secret_key | str | (required) | Secret key for signing |
algorithm | str | "HS256" | JWT signing algorithm |
token_lifetime | int | 3600 | Token lifetime in seconds |
issuer | str | None | Token issuer (iss claim) |
audience | str | None | Token audience (aud claim) |
custom_claims | dict | Additional custom claims |
Supported Algorithms
| Family | Algorithms |
|---|---|
| HMAC | HS256, HS384, HS512 |
| RSA | RS256, RS384, RS512 |
| ECDSA | ES256, ES384, ES512 |
| RSA-PSS | PS256, PS384, PS512 |
JWT support requires the jwt extra:
- pip:
pip install intapp-rest-client[jwt] - uv:
uv add intapp-rest-client[jwt] - poetry:
poetry add intapp-rest-client -E jwt
RetryConfig
Configuration for retry behavior.
from intapp_rest_client import RetryConfig
config = RetryConfig(
max_retries=5,
backoff_factor=2.0,
retryable_statuses=(429, 500, 502, 503, 504),
respect_retry_after=True,
max_backoff=60.0,
retry_count_by_status={429: 10, 500: 2},
jitter=True,
jitter_min=0.5,
jitter_max=1.5
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
max_retries | int | 3 | Default retry count |
backoff_factor | float | 2.0 | Exponential backoff multiplier |
retryable_statuses | tuple | (429, 500, 502, 503, 504) | Status codes that trigger retry |
respect_retry_after | bool | True | Honor Retry-After header |
max_backoff | float | 60.0 | Maximum wait between retries |
retry_count_by_status | dict | None | Per-status retry counts |
jitter | bool | True | Add randomization to backoff |
jitter_min | float | 0.5 | Minimum jitter multiplier |
jitter_max | float | 1.5 | Maximum jitter multiplier |
Methods
config = RetryConfig(...)
# Get retry count for a specific status
count = config.get_max_retries_for_status(429) # Returns per-status or default
# Check if status should trigger retry
should_retry = config.should_retry(429) # True if in retryable_statuses
# Copy that drops given statuses from retry lists (e.g. custom transports / fail-fast on 429)
no_429 = config.without_retry_on_statuses(429)without_retry_on_statuses returns a new RetryConfig with those HTTP statuses removed from retryable_statuses and from retry_count_by_status keys. The built-in client uses this pattern internally for code paths that must not retry 429.
ConnectionPoolConfig
Configuration for HTTP connection pooling.
from intapp_rest_client import ConnectionPoolConfig
config = ConnectionPoolConfig(
max_connections=100,
max_keepalive_connections=20,
keepalive_expiry=5.0
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
max_connections | int | 100 | Maximum total connections |
max_keepalive_connections | int | 20 | Maximum persistent connections |
keepalive_expiry | float | 5.0 | Idle timeout in seconds |
SSLConfig
SSL/TLS configuration for custom certificates and verification. Pass as ssl_config to RestClient. See SSL/TLS configuration for usage.
from intapp_rest_client import RestClient, SSLConfig
# Custom CA bundle for internal APIs
client = RestClient(
base_url="https://api.example.com",
api_key="key",
ssl_config=SSLConfig(ca_bundle="/etc/ssl/certs/company-ca.crt")
)
# Mutual TLS (client certificate)
client = RestClient(
base_url="https://api.example.com",
api_key="key",
ssl_config=SSLConfig(
client_cert="/path/to/client.crt",
client_key="/path/to/client.key"
)
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
verify | bool | True | Enable SSL certificate verification |
ca_bundle | str | None | Path to custom CA bundle file or directory |
client_cert | str | None | Path to client certificate (mutual TLS) |
client_key | str | None | Path to client private key (required if client_cert set) |
client_key_password | str | None | Password for encrypted client key |
Set verify=False only for development/testing. Never disable verification in production.
CircuitBreakerConfig
Configuration for circuit breaker pattern.
from intapp_rest_client import CircuitBreakerConfig
config = CircuitBreakerConfig(
failure_threshold=5,
reset_timeout=60.0,
half_open_requests=1,
failure_statuses=(500, 502, 503, 504),
count_network_errors=True
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
failure_threshold | int | 5 | Failures before opening circuit |
reset_timeout | float | 60.0 | Seconds before trying again |
half_open_requests | int | 1 | Test requests when half-open |
failure_statuses | tuple | (500, 502, 503, 504) | Status codes that count as failures |
count_network_errors | bool | True | Count network errors as failures |
Circuit States
from intapp_rest_client import CircuitState
CircuitState.CLOSED # Normal operation
CircuitState.OPEN # Failing fast
CircuitState.HALF_OPEN # Testing recoveryRestClient builds RetryTransport without a CircuitBreaker, so the breaker types are for advanced use: pass a CircuitBreaker into RetryTransport / AsyncRetryTransport if you compose custom httpx clients, or use the exported CircuitBreaker class in your own orchestration.
EntraConfig
Configuration for Microsoft Entra ID (Azure AD).
from intapp_rest_client import EntraConfig
config = EntraConfig(
tenant_id="your-tenant-id",
client_id="your-client-id",
client_secret="your-client-secret",
scope="api://your-api/.default"
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
tenant_id | str | (required) | Azure AD tenant ID |
client_id | str | (required) | Application (client) ID |
client_secret | str | (required) | Client secret |
scope | str | (required) | API scope (usually ends with .default) |
OktaConfig
Configuration for Okta authentication.
from intapp_rest_client import OktaConfig
config = OktaConfig(
domain="your-org.okta.com",
client_id="your-client-id",
client_secret="your-client-secret",
scope="api-scope"
)Fields
| Field | Type | Default | Description |
|---|---|---|---|
domain | str | (required) | Okta domain (org.okta.com) |
client_id | str | (required) | Okta client ID |
client_secret | str | (required) | Okta client secret |
scope | str | (required) | API scope |
LogLevel
Logging levels for the client.
from intapp_rest_client import LogLevel
LogLevel.DEBUG # 10 - All details
LogLevel.INFO # 20 - Standard (default)
LogLevel.WARNING # 30 - Warnings and errors
LogLevel.ERROR # 40 - Errors only
LogLevel.CRITICAL # 50 - Critical onlyAuthType
Authentication type enumeration.
from intapp_rest_client import AuthType
AuthType.NONE # No authentication
AuthType.OAUTH2_CLIENT_CREDENTIALS # OAuth2 client credentials
AuthType.OAUTH2_PASSWORD # OAuth2 password grant
AuthType.OAUTH2_REFRESH_TOKEN # OAuth2 refresh token
AuthType.API_KEY # API key (header or query)
AuthType.JWT # JWT token
AuthType.BASIC # HTTP Basic auth
AuthType.ENTRA_ID # Microsoft Entra ID
AuthType.OKTA # OktaErrorHandling
Error handling mode for parallel methods (parallel_get, parallel_post, parallel_put, parallel_delete, and async aparallel_*).
from intapp_rest_client import RestClient, ErrorHandling
ErrorHandling.FAIL_FAST # Raise on first error (default)
ErrorHandling.COLLECT # Collect all errors, return (results, errors)
ErrorHandling.LOG_ONLY # Log errors and continue, return (results, errors)| Value | Behavior |
|---|---|
FAIL_FAST | Raise on first failure; return list of results only |
COLLECT | Continue on failure; return (results, errors) |
LOG_ONLY | Same as COLLECT; errors are also logged |