Skip to main content

OAuth Flow

Get Authorization URL

GET /api/v1/hubspot/auth-url Returns HubSpot OAuth authorization URL and signed state token.
url
string
HubSpot OAuth URL
state
string
Signed state token (expires in 10 minutes)

OAuth Callback

POST /api/v1/hubspot/callback Handles OAuth callback and creates/updates connection.
code
string
required
OAuth authorization code
state
string
required
Signed state token
status
string
Connection status
connection_id
string
HubSpot connection ID
portal_id
string
HubSpot portal ID

Connections

List Connections

GET /api/v1/hubspot/connections Returns your active HubSpot connections.
connections
array
Array of connection objects

Sync Pages

POST /api/v1/hubspot/sync/{connection_id} Synchronizes HubSpot CMS pages for a connection.
status
string
Sync status
synced_count
integer
Number of pages synced

Pages

List Pages

GET /api/v1/hubspot/pages/{connection_id} Returns synchronized HubSpot pages.
curl -X GET https://api.latentgeo.com/api/v1/hubspot/pages/conn_123 \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "id": "page_123",
    "hubspot_id": "12345678",
    "title": "Product Page",
    "url": "https://example.com/products",
    "meta_description": "Shop our products",
    "html_title": "Products | Example",
    "connection_id": "conn_123",
    "created_at": "2026-03-03T10:00:00Z"
  }
]
pages
array
Array of HubSpot page objects

Recommendations

Get Recommendations

GET /api/v1/hubspot/recommendations/{audit_id} Generates SEO recommendations for HubSpot pages based on an audit.
recommendations
array
Array of recommendation objects

Apply Recommendations

POST /api/v1/hubspot/apply-recommendations Applies a batch of recommendations to HubSpot pages.
curl -X POST https://api.latentgeo.com/api/v1/hubspot/apply-recommendations \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "audit_id": 123,
    "recommendations": [
      {
        "hubspot_page_id": "12345678",
        "field": "meta_description",
        "recommended_value": "Optimized meta description"
      }
    ]
  }'
audit_id
integer
required
Audit ID
recommendations
array
required
Array of recommendations to apply
status
string
Batch operation status
applied
integer
Number of recommendations applied
failed
integer
Number of failed recommendations
details
object
Detailed results by page

Rollback Change

POST /api/v1/hubspot/rollback/{change_id} Reverts a previously applied change.
status
string
Rollback status
new_change_id
string
ID of the rollback change record

Error Codes

400
error
Invalid OAuth callback or change cannot be rolled back
401
error
Invalid OAuth state
403
error
Cross-user access denied or legacy ownerless connection blocked
404
error
Page or change not found
500
error
Internal server error

Build docs developers (and LLMs) love