{
  "info": {
    "name": "Toutatis IDV",
    "_postman_id": "toutatis-idv-v1",
    "description": "Public API for Toutatis IDV — session lifecycle + webhook verification helpers.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "https://toutatis.eu/erp/custom/storecoveadmin/api_proxy_server/idv" },
    { "key": "client_id", "value": "REPLACE_ME" },
    { "key": "client_api_key", "value": "REPLACE_ME" },
    { "key": "session_id", "value": "" }
  ],
  "item": [
    {
      "name": "Health",
      "request": {
        "method": "GET",
        "url": "{{base_url}}/proxy.php?action=health"
      }
    },
    {
      "name": "Create session (document_only)",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const j = pm.response.json();",
              "if (j.session_id) pm.collectionVariables.set('session_id', j.session_id);",
              "pm.test('has session_url', () => pm.expect(j.session_url).to.include('/v/'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{base_url}}/proxy.php?action=session.create",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"client_id\": \"{{client_id}}\",\n  \"client_api_key\": \"{{client_api_key}}\",\n  \"flow\": \"document_only\",\n  \"reference\": \"postman-test-001\",\n  \"locale\": \"fr\",\n  \"country_hint\": \"FR\",\n  \"expires_in_seconds\": 1800\n}"
        }
      }
    },
    {
      "name": "Create session (kyc_full)",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{base_url}}/proxy.php?action=session.create",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"client_id\": \"{{client_id}}\",\n  \"client_api_key\": \"{{client_api_key}}\",\n  \"flow\": \"kyc_full\",\n  \"reference\": \"kyc-001\",\n  \"redirect_url\": \"https://example.com/thanks\"\n}"
        }
      }
    },
    {
      "name": "Create session (age_verify)",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{base_url}}/proxy.php?action=session.create",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"client_id\": \"{{client_id}}\",\n  \"client_api_key\": \"{{client_api_key}}\",\n  \"flow\": \"age_verify\",\n  \"reference\": \"age-001\"\n}"
        }
      }
    },
    {
      "name": "Session status",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{base_url}}/proxy.php?action=session.status",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"client_id\": \"{{client_id}}\",\n  \"client_api_key\": \"{{client_api_key}}\",\n  \"session_id\": \"{{session_id}}\"\n}"
        }
      }
    },
    {
      "name": "Cancel session",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "url": "{{base_url}}/proxy.php?action=session.cancel",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"client_id\": \"{{client_id}}\",\n  \"client_api_key\": \"{{client_api_key}}\",\n  \"session_id\": \"{{session_id}}\",\n  \"reason\": \"user aborted\"\n}"
        }
      }
    }
  ]
}
