GoHighLevel API Integration: Payloads, Endpoints & Authentication
Developer guide to the GoHighLevel v2 REST API. Master OAuth 2.0, Private Integration Tokens, /contacts/upsert, custom fields, and webhook HMAC validation.
- HighLevel API v2 requires Bearer token authentication and the "Version: 2021-07-28" header.
- Always utilize POST /contacts/upsert rather than /contacts to avoid generating duplicate records.
- Custom fields in API v2 are passed as an array of objects: [{ key: "field_key", field_value: "value" }].
- Handle rate limits defensively: HighLevel limits requests to 10 requests per second per Location.
- •Receiving HTTP 401 Unauthorized or 403 Forbidden when calling HighLevel API endpoints.
- •Duplicate contacts created because the API script used /contacts instead of /contacts/upsert.
- •Custom field values failing to populate on contact records after API submission.
- •Rate limit HTTP 429 Too Many Requests errors during batch synchronization scripts.
Authentication: Private Integration Tokens vs. OAuth 2.0
Understand which authentication model is required for your project.
Private Integration Tokens (Recommended for single-agency sub-account integration): Generated in Settings > Private Integrations inside your HighLevel sub-account. Provides a permanent scoped Bearer token tied to your specific Location ID.
OAuth 2.0 (Required for Marketplace Apps and Multi-Tenant SaaS Mode): Requires building an authorization code exchange flow with token refresh endpoints (`POST /oauth/token`). Required when your app needs to access multiple client sub-accounts.
All API calls must target `https://services.leadconnectorhq.com` and include `Version: 2021-07-28` in the request headers.
Tested Code Example: Contact Upsert with Custom Fields
This tested Node.js script demonstrates how to upsert a contact, apply tags, and populate custom fields.
The `/contacts/upsert` endpoint automatically looks up contacts by email and phone number. If found, it updates the record; if not found, it creates a new contact.
Always supply the sub-account `locationId` in the request body.
const token = process.env.GHL_PRIVATE_INTEGRATION_TOKEN;
const locationId = process.env.GHL_LOCATION_ID;
const response = await fetch('https://services.leadconnectorhq.com/contacts/upsert', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
'Version': '2021-07-28'
},
body: JSON.stringify({
locationId: locationId,
email: 'client@example.com',
phone: '+15552345678',
firstName: 'Marcus',
lastName: 'Vance',
name: 'Marcus Vance',
source: 'Website API Ingest',
tags: ['website-lead', 'api-verified'],
customFields: [
{ key: 'requested_service', field_value: 'API Integration' },
{ key: 'deal_budget', field_value: '$3,500' }
]
})
});
const data = await response.json();
console.log('Upserted Contact ID:', data.contact?.id);Frequently Asked Questions
Where do I find my Custom Field Key for API requests?
Go to Settings > Custom Fields in your sub-account. Click the edit icon next to the field. Look for the "Field Key" (e.g. `contact.requested_service` or `requested_service`).
GoHighLevel API Integration
Server-side integrations that move customer data reliably between forms, CRMs, payment gateways, and reporting tools.

Kaisar Hasan
CRM SpecialistGoHighLevel CRM Automation Specialist working with agencies, consultants, and service businesses worldwide. Specializes in defensive workflow logic, custom webhooks, API integrations, and A2P 10DLC compliance.
Related Diagnostic Guides
GoHighLevel API vs Zapier Integration
When to use direct API work, webhooks, Zapier, Make or a hybrid integration approach.
GoHighLevel Inbound Webhook Automation: Developer Guide
Master GoHighLevel inbound webhook triggers. Learn JSON payload mapping, Stripe checkout connections, secret authentication, and how to eliminate Zapier fees.
