Skip to main content

DocsREST API and MCP server

CRM Connect (OAuth) API

Endpoints, auth and live samples for Audience Builder, Connect Data and CRM sync.

Base URLhttps://us-farmvision-new-api.onrender.com

CRM Connect (OAuth)

Start CRM Authorization

Returns an authorizeUrl to open in the browser; it does not redirect by itself. Call it from the same browser that will open that URL, with credentials included: it sets a short-lived cookie the callback checks, and the attempt expires after 5 minutes. API keys and MCP tokens get 403; 400 if returnTo is not on a GTM Scoop web-app origin; 503 if the provider is not set up on the server.

POSThttps://us-farmvision-new-api.onrender.com/api/v1/:provider/authorizeTry it

In this section

Authentication

Get API key

Signed-in web session only

This action needs a person signed in to the GTM Scoop web app. API keys and MCP tokens get 403. The browser sends its session cookie, plus the x-csrf-token header on writes; the session's access token also works as a Bearer token.

Authorization: Bearer YOUR_SESSION_TOKEN

Parameters

application/json
FieldTypeDescription
providerpathrequiredstring"salesforce" or "hubspot".
returnTobodystringFull URL the browser returns to after the provider sign-in. Must be on a GTM Scoop web-app origin. Default: the web app's /salesforce or /hubspot page.

Mounted at

/api/v1

Connects a Salesforce org or HubSpot portal to the account with OAuth (PKCE): start from the browser, let the provider redirect back, then check status. provider is salesforce or hubspot, and one connection of each is kept per account.

Try it in the playground

Signed out: 10 free tries a day with names hidden. Log in for live data.

Open playground

Related endpoints

All 4 endpoints in this section

Bearer token for status; authorize and disconnect need a signed-in web session; the callback uses a signed, single-use state.

MethodPathWhat it does
POST/api/v1/:provider/authorize

Start CRM Authorization

Returns an authorizeUrl to open in the browser; it does not redirect by itself. Call it from the same browser that will open that URL, with credentials included: it sets a short-lived cookie the callback checks, and the attempt expires after 5 minutes. API keys and MCP tokens get 403; 400 if returnTo is not on a GTM Scoop web-app origin; 503 if the provider is not set up on the server.

2 parameters
  • provider (string, required) "salesforce" or "hubspot".
  • returnTo (string) Full URL the browser returns to after the provider sign-in. Must be on a GTM Scoop web-app origin. Default: the web app's /salesforce or /hubspot page.
GET/api/v1/:provider/callback

CRM OAuth Callback

Where Salesforce or HubSpot sends the browser after the person approves access; you never call it yourself. It checks the signed state against the cookie set by authorize, exchanges the code, saves the connection and redirects to returnTo. The redirect carries fixed codes only, never provider text.

5 parameters
  • provider (string, required) "salesforce" or "hubspot".
  • code (string) Authorization code from the provider (absent when the person cancels).
  • state (string, required) The signed state from authorize. Valid for 5 minutes, once, and only in the browser that started the flow.
  • error (string) Set by the provider when the sign-in was cancelled or failed.
  • error_description (string) The provider's error text. Only used to tell a cancel from other errors; never passed on.
GET/api/v1/:provider/status

Get CRM Connection Status

Whether the account has a working connection: the saved token is checked live against the CRM (a success is cached for 60 seconds), so an expired or revoked login reports connected: false and connection: null. HubSpot's connection is { portalId, hubDomain, email, connectedAt }. Salesforce also returns objects (columns and search field of Account, Contact, Lead, Opportunity, Case and ContentVersion) and createFields (the fields each object accepts on create and update); the example is trimmed to Contact.

1 parameter
  • provider (string, required) "salesforce" or "hubspot".
Try Get CRM Connection Status in the Playground
POST/api/v1/:provider/disconnect

Disconnect CRM

Revokes the saved token with the provider (best effort) and deletes the connection, so CRM reads, syncs, write-backs and sends stop until the account connects again. Always returns success, even when nothing was connected. API keys and MCP tokens get 403.

1 parameter
  • provider (string, required) "salesforce" or "hubspot".

Cookies on GTM Scoop

Essential cookies keep you signed in and the site secure, and are always on. Optional cookies (Google Analytics) help us understand how the site is used. They are on by default, except in the EU/EEA, the UK and Switzerland, where they stay off until you choose Accept All Cookies; choose Essential Cookies Only to turn them off. We do not use advertising cookies and we do not sell or share your personal information. The site works the same whichever you choose. We keep a record of your choice with the date, your IP address and the page you were on. Cookie Policy · Privacy Policy