Skip to content
TriedDocs
Integrations

Refresh OAuth token

Force an OAuth token refresh for a CRM connection or an integration app.

POSThttps://api.tried.com.au/oauth/refresh

Needs keys Refreshing a real vendor token needs the vendor's OAuth client ID and secret on the server. Connections from the mock provider refresh against the mock token endpoint.

Refreshes the access token of an OAuth connection now. You rarely need it: Tried refreshes tokens that are within 5 minutes of expiry before each use, and a background task refreshes connections that expire within 10 minutes. Use it to check that a refresh token still works.

Request#

Field Type Required Description
target string Yes crm or app.
provider string For crm The CRM: hubspot, salesforce, dynamics365, zoho or gohighlevel.
app_id string For app The integration app's app_id.

Example request#

curl -X POST https://api.tried.com.au/oauth/refresh \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "target": "app", "app_id": "app_3d9a7e1f5c2b8046d7e9a1c3" }'
const res = await fetch("https://api.tried.com.au/oauth/refresh", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ target: "app", app_id: "app_3d9a7e1f5c2b8046d7e9a1c3" }),
});
const result = await res.json();
import os, requests

res = requests.post(
    "https://api.tried.com.au/oauth/refresh",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={"target": "app", "app_id": "app_3d9a7e1f5c2b8046d7e9a1c3"},
)
result = res.json()

Response#

200 OK

{ "refreshed": true, "expires_at": 1792401600000 }
Field Type Description
refreshed boolean Always true on a 200.
expires_at integer Unix ms expiry of the access token now stored.

If the vendor rejects the refresh, the stored token is kept and expires_at shows its old expiry. For an app, its status also becomes error. Compare expires_at with the current time to tell the two apart.

Errors#

Status When
400 Body fails validation, or This connection does not use OAuth (credentials were set by hand).
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the admin scope. Dashboard users need the admin or developer role.
404 Connection not found: no CRM connection for provider, or no app with app_id, in this workspace.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.