# Check a Connect request before showing it

> POST /v0/connect/check. Validates what a plugin sent to `dashboard.intents.fi/connect`: a known platform, https URLs, a `return_url` on the same origin as `site_url`, a `state` and an S256 `code_challenge`. A refused request is never shown and the browser is never sent to its `return_url`. Needs no 


`POST /v0/connect/check`

Validates what a plugin sent to `dashboard.intents.fi/connect`: a known platform, https URLs, a `return_url` on the same origin as `site_url`, a `state` and an S256 `code_challenge`. A refused request is never shown and the browser is never sent to its `return_url`. Needs no authentication and reads nothing.

## 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

| Field | Type | Required | Notes |
|---|---|---|---|
| `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento |
| `site_url` | string | yes | The store, e.g. `https://shop.example.com` |
| `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. |
| `state` | string | yes | The plugin's own random value, echoed back |
| `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) |
| `code_challenge_method` | `S256` | no |  |
| `mode` | `test` \| `live` | no | Default `test` |
| `partner` | string | no | Agency Partner ID, when present |

## Responses

| Status | Means |
|---|---|
| `200` | A request the consent screen may show |
| `400` | INVALID_REQUEST, with `details.field` |


## Request



```bash title="curl"
curl https://api.intents.fi/v0/connect/check \
  -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"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/connect/check", {
  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 title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/connect/check",
    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

```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](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api).

---

Source: https://intents.fi/docs/api/post-connect-check · The whole corpus: https://intents.fi/docs/llms-full.txt
