Skip to content

Configuration

The published config file (config/hubspot.php) allows you to configure the API connection, rate limiting, query caching, default properties and associations per object type, HTTP timeouts, request logging, and webhook handling.

Full Config Reference

php
return [
    'base_url' => env('HUBSPOT_BASE_URL', 'https://api.hubapi.com'),
    'access_token' => env('HUBSPOT_ACCESS_TOKEN'),

    // Property definition caching (set to false to disable)
    'definitions' => [
        'cache' => '30 days',
    ],

    // Rate limiting per HubSpot tier
    // Free/Starter: 100 requests per 10 seconds
    // Professional/Enterprise: 150 requests per 10 seconds
    'rate_limit' => [
        'requests' => (int) env('HUBSPOT_RATE_LIMIT_REQUESTS', 100),
        'per_seconds' => (int) env('HUBSPOT_RATE_LIMIT_PER_SECONDS', 10),
    ],

    // Query-level caching (requires ->cache() call on queries)
    'cache' => [
        'enabled' => (bool) env('HUBSPOT_CACHE_ENABLED', false),
        'store' => env('HUBSPOT_CACHE_STORE'),
        'prefix' => env('HUBSPOT_CACHE_PREFIX', 'hubspot'),
        'ttl' => (int) env('HUBSPOT_CACHE_TTL', 3600),
        'auto_invalidate' => (bool) env('HUBSPOT_CACHE_AUTO_INVALIDATE', true),
    ],

    // Default properties and associations loaded for each object type
    'contacts' => [
        'include_properties' => ['firstname', 'lastname', 'email'],
        'include_associations' => ['companies', 'contact', 'deals', 'tickets'],
    ],

    'companies' => [
        'include_properties' => ['domain', 'name', 'phone'],
        'include_associations' => ['contacts', 'deals', 'tickets'],
    ],

    // ... additional object types ...

    // Pipeline caching (set to false to disable)
    'pipelines' => [
        'cache' => '1 hour',
    ],

    'http' => [
        'timeout' => (int) env('HUBSPOT_HTTP_TIMEOUT', 10),
        'connect_timeout' => (int) env('HUBSPOT_HTTP_CONNECT_TIMEOUT', 10),
    ],

    // API request/response logging
    'logging' => [
        'enabled' => (bool) env('HUBSPOT_LOGGING_ENABLED', false),
        'channel' => env('HUBSPOT_LOGGING_CHANNEL'),
        'log_bodies' => (bool) env('HUBSPOT_LOGGING_BODIES', false),
        'body_sanitizer' => null,
    ],

    // Webhook handling (opt-in, activated by setting client_secret)
    'webhooks' => [
        'client_secret' => env('HUBSPOT_WEBHOOK_SECRET'),
        'path' => env('HUBSPOT_WEBHOOK_PATH', 'hubspot/webhooks'),
        'middleware' => ['api'],
        'verify_signature' => true,
        'tolerance' => 300,
        'queue' => ['enabled' => false, 'connection' => null, 'queue' => null],
        'hydrate_models' => true,
        'only' => [],
        'except' => [],
        'deduplicate' => false,
        'deduplicate_ttl' => 3600,
    ],
];

Config Options

API Connection

OptionDescriptionDefault
base_urlThe HubSpot API base URL. You should not need to change this.https://api.hubapi.com
access_tokenYour HubSpot private app access token.null

Property Definitions

OptionDescriptionDefault
definitions.cacheHow long to cache property definitions fetched from HubSpot. Set to false to disable caching.'30 days'

Rate Limiting

Rate limits are enforced automatically via Saloon and backed by Laravel Cache.

OptionDescriptionDefault
rate_limit.requestsMaximum number of requests allowed per window. Free/Starter plans allow 100; Professional/Enterprise plans allow 150.100
rate_limit.per_secondsThe time window in seconds for the rate limit.10

Query Caching

Query caching is opt-in. You must call ->cache() on a query for results to be cached. These options configure the defaults.

OptionDescriptionDefault
cache.enabledWhether query caching is available.false
cache.storeThe Laravel cache store to use. null uses the default store.null
cache.prefixKey prefix for all cached queries.'hubspot'
cache.ttlDefault time-to-live in seconds for cached queries.3600
cache.auto_invalidateAutomatically invalidate cached queries when write operations occur.true

Object Type Defaults

Each object type key (e.g. contacts, deals, companies) accepts:

OptionDescription
include_propertiesProperties included by default on every query for that type.
include_associationsAssociations included by default on every query for that type.

Pipelines

OptionDescriptionDefault
pipelines.cacheHow long to cache pipeline definitions. Set to false to disable.'1 hour'

HTTP

OptionDescriptionDefault
http.timeoutRequest timeout in seconds.10
http.connect_timeoutConnection timeout in seconds.10

Logging

OptionDescriptionDefault
logging.enabledEnable API request/response logging.false
logging.channelThe Laravel log channel to use. null uses the default channel.null
logging.log_bodiesWhether to log request and response bodies.false
logging.body_sanitizerA callable for sanitizing logged bodies (e.g. to redact PII).null

Webhooks

Webhook handling is opt-in and activated by setting the client_secret.

OptionDescriptionDefault
webhooks.client_secretYour HubSpot app client secret, used for HMAC-SHA256 signature verification.null
webhooks.pathThe URI path where the webhook endpoint is registered.'hubspot/webhooks'
webhooks.middlewareMiddleware applied to the webhook route.['api']
webhooks.verify_signatureWhether to verify the HMAC-SHA256 signature on incoming requests.true
webhooks.toleranceMaximum age of a webhook request in seconds before it is rejected.300
webhooks.queue.enabledWhether to dispatch webhook events to a queue.false
webhooks.queue.connectionThe queue connection to use. null uses the default.null
webhooks.queue.queueThe queue name to use. null uses the default.null
webhooks.hydrate_modelsWhether to automatically hydrate CRM models from webhook payloads.true
webhooks.onlyAn array of event types to process. Empty means all.[]
webhooks.exceptAn array of event types to ignore.[]
webhooks.deduplicateWhether to deduplicate webhook events.false
webhooks.deduplicate_ttlTTL in seconds for the deduplication cache.3600

Environment Variables

All available environment variables at a glance:

VariableDescriptionDefault
HUBSPOT_BASE_URLAPI base URLhttps://api.hubapi.com
HUBSPOT_ACCESS_TOKENPrivate app access token
HUBSPOT_RATE_LIMIT_REQUESTSRate limit request count100
HUBSPOT_RATE_LIMIT_PER_SECONDSRate limit window in seconds10
HUBSPOT_CACHE_ENABLEDEnable query cachingfalse
HUBSPOT_CACHE_STORECache store nameDefault store
HUBSPOT_CACHE_PREFIXCache key prefixhubspot
HUBSPOT_CACHE_TTLCache TTL in seconds3600
HUBSPOT_CACHE_AUTO_INVALIDATEAuto-invalidate cache on writestrue
HUBSPOT_HTTP_TIMEOUTHTTP request timeout in seconds10
HUBSPOT_HTTP_CONNECT_TIMEOUTHTTP connection timeout in seconds10
HUBSPOT_LOGGING_ENABLEDEnable request loggingfalse
HUBSPOT_LOGGING_CHANNELLog channel nameDefault channel
HUBSPOT_LOGGING_BODIESLog request/response bodiesfalse
HUBSPOT_WEBHOOK_SECRETWebhook client secret
HUBSPOT_WEBHOOK_PATHWebhook endpoint pathhubspot/webhooks