Skip to content
Intents Route
POST/v0/connect/authorize

Approve a Connect request (the consent screen's Connect button)

Dashboard session only. Re-checks the request, then issues a single-use code (5 minutes) bound to the site, the return URL and the challenge. mode: live is LIVE_MODE_LOCKED until the go-live checklist is done. Choose the account with x-account-id.

A secret key (ik_) as a Bearer token. The prefix sets the mode: _test_ or _live_. Publishable keys (pk_) cannot call it.

  • platformstringRequired

    One of woocommerce, whmcs, prestashop, opencart, magento

  • site_urlstringRequired

    The store, e.g. https://shop.example.com

  • return_urlstringRequired

    Where the browser goes back to. Must share site_url's origin.

  • statestringRequired

    The plugin's own random value, echoed back

  • code_challengestringRequired

    base64url(SHA-256(code_verifier))

  • code_challenge_methodS256Optional
  • modetest \| liveOptional

    Default test

  • partnerstringOptional

    Agency Partner ID, when present

  • 200Approved
  • 400INVALID_REQUEST
  • 401No valid dashboard session
  • 403SESSION_REQUIRED for an API key; FORBIDDEN below the role needed
curl
curl https://api.intents.fi/v0/connect/authorize \
-X POST \
-H 'authorization: Bearer $INTENTS_SECRET_KEY' \
-H 'content-type: application/json' \
-d '{
"platform": "woocommerce",
"site_url": "https://shop.northwood.example",
"return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
"state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
"code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"mode": "test"
}'
TypeScript
const response = await fetch("https://api.intents.fi/v0/connect/authorize", {
method: "POST",
headers: {
authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
"platform": "woocommerce",
"site_url": "https://shop.northwood.example",
"return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
"state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
"code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"mode": "test"
}),
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
Python
import os
import httpx
response = httpx.post(
"https://api.intents.fi/v0/connect/authorize",
headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
json={
"platform": "woocommerce",
"site_url": "https://shop.northwood.example",
"return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
"state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
"code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"mode": "test"
},
)
response.raise_for_status()
data = response.json()
{ "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } }

Switch on code, not on the message: every code has a page under Error codes. Base URL https://api.intents.fi; the whole reference is on one page.