/v0/connect/authorizeApprove 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.
Authentication
Section titled “Authentication”A secret key (ik_) as a Bearer token. The prefix sets the mode: _test_ or _live_. Publishable keys (pk_) cannot call it.
Body parameters
Section titled “Body parameters”platformstringRequiredOne of woocommerce, whmcs, prestashop, opencart, magento
site_urlstringRequiredThe store, e.g.
https://shop.example.comreturn_urlstringRequiredWhere the browser goes back to. Must share
site_url's origin.statestringRequiredThe plugin's own random value, echoed back
code_challengestringRequiredbase64url(SHA-256(code_verifier))
code_challenge_methodS256Optionalmodetest\|liveOptionalDefault
testpartnerstringOptionalAgency Partner ID, when present
Responses
Section titled “Responses”- 200Approved
- 400INVALID_REQUEST
- 401No valid dashboard session
- 403SESSION_REQUIRED for an API key; FORBIDDEN below the role needed
Request
Section titled “Request”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" }'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();import osimport 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()Errors
Section titled “Errors”{ "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.