{"openapi":"3.1.0","info":{"title":"Affiliate accounts API","version":"1.0.0","description":"Create and manage affiliate accounts with every detail your console holds: for a network (tk_ keys), a SubNetwork operator (snk_ keys) and a brand (mk_ keys: a single advertiser, or a brand inside a network). Additive to /api/v1. One scope per action. Create requires an Idempotency-Key header."},"servers":[{"url":"https://api.example.com/api"}],"paths":{"/v1/network/affiliate-accounts":{"post":{"operationId":"network_post_affiliate_accounts","summary":"Create an affiliate account (Idempotency-Key required)","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:create"]}],"x-required-scope":"affiliate-accounts:create","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"$ref":"#/components/parameters/IdempotencyKeyRequired"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/network/affiliate-accounts\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ana@example.com\",\n  \"display_name\": \"Ana'\\''s Deals\",\n  \"legal_name\": \"Ana Deals Ltd\",\n  \"first_name\": \"Ana\",\n  \"last_name\": \"Silva\",\n  \"country\": \"GB\",\n  \"language\": \"en\",\n  \"currency\": \"EUR\",\n  \"phones\": [\n    {\n      \"number\": \"+44 20 7946 0000\",\n      \"label\": \"office\"\n    }\n  ],\n  \"website\": \"https://anadeals.example.com\",\n  \"properties\": [\n    {\n      \"type\": \"website\",\n      \"name\": \"Ana'\\''s Deals\",\n      \"url\": \"https://anadeals.example.com\",\n      \"soft_click\": true,\n      \"coupon_prefix\": \"ANA\"\n    }\n  ],\n  \"programmes\": [\n    {\n      \"brand_id\": 4001,\n      \"state\": \"invited\"\n    }\n  ],\n  \"tags\": [\n    \"fashion\"\n  ],\n  \"reason\": \"Onboarded from our CRM\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ana@example.com\",\n    \"display_name\": \"Ana's Deals\",\n    \"legal_name\": \"Ana Deals Ltd\",\n    \"first_name\": \"Ana\",\n    \"last_name\": \"Silva\",\n    \"country\": \"GB\",\n    \"language\": \"en\",\n    \"currency\": \"EUR\",\n    \"phones\": [\n      {\n        \"number\": \"+44 20 7946 0000\",\n        \"label\": \"office\"\n      }\n    ],\n    \"website\": \"https://anadeals.example.com\",\n    \"properties\": [\n      {\n        \"type\": \"website\",\n        \"name\": \"Ana's Deals\",\n        \"url\": \"https://anadeals.example.com\",\n        \"soft_click\": true,\n        \"coupon_prefix\": \"ANA\"\n      }\n    ],\n    \"programmes\": [\n      {\n        \"brand_id\": 4001,\n        \"state\": \"invited\"\n      }\n    ],\n    \"tags\": [\n      \"fashion\"\n    ],\n    \"reason\": \"Onboarded from our CRM\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/network/affiliate-accounts\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ana@example.com\",\n      \"display_name\": \"Ana's Deals\",\n      \"legal_name\": \"Ana Deals Ltd\",\n      \"first_name\": \"Ana\",\n      \"last_name\": \"Silva\",\n      \"country\": \"GB\",\n      \"language\": \"en\",\n      \"currency\": \"EUR\",\n      \"phones\": [\n        {\n          \"number\": \"+44 20 7946 0000\",\n          \"label\": \"office\"\n        }\n      ],\n      \"website\": \"https://anadeals.example.com\",\n      \"properties\": [\n        {\n          \"type\": \"website\",\n          \"name\": \"Ana's Deals\",\n          \"url\": \"https://anadeals.example.com\",\n          \"soft_click\": True,\n          \"coupon_prefix\": \"ANA\"\n        }\n      ],\n      \"programmes\": [\n        {\n          \"brand_id\": 4001,\n          \"state\": \"invited\"\n        }\n      ],\n      \"tags\": [\n        \"fashion\"\n      ],\n      \"reason\": \"Onboarded from our CRM\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateAccountCreate"},"example":{"email":"ana@example.com","display_name":"Ana's Deals","legal_name":"Ana Deals Ltd","first_name":"Ana","last_name":"Silva","country":"GB","language":"en","currency":"EUR","phones":[{"number":"+44 20 7946 0000","label":"office"}],"website":"https://anadeals.example.com","properties":[{"type":"website","name":"Ana's Deals","url":"https://anadeals.example.com","soft_click":true,"coupon_prefix":"ANA"}],"programmes":[{"brand_id":4001,"state":"invited"}],"tags":["fashion"],"reason":"Onboarded from our CRM"}}}}},"get":{"operationId":"network_get_affiliate_accounts","summary":"List affiliate accounts (paged, filtered)","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"tag","in":"query","required":false,"schema":{"type":"string"}},{"name":"brand_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"programme_state","in":"query","required":false,"schema":{"type":"string"}},{"name":"email","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/network/affiliate-accounts\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/network/affiliate-accounts\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]}},"/v1/network/affiliate-accounts/{account_id}":{"get":{"operationId":"network_get_affiliate_accounts_account_id","summary":"One affiliate account, with every detail","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/network/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]},"patch":{"operationId":"network_patch_affiliate_accounts_account_id","summary":"Change an affiliate account's details","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:update"]}],"x-required-scope":"affiliate-accounts:update","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X PATCH \"https://api.example.com/api/v1/network/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"country\": \"PT\",\n  \"tags\": [\n    \"fashion\",\n    \"vip\"\n  ],\n  \"reason\": \"CRM sync\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001\", {\n  method: \"PATCH\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"country\": \"PT\",\n    \"tags\": [\n      \"fashion\",\n      \"vip\"\n    ],\n    \"reason\": \"CRM sync\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.patch(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"country\": \"PT\",\n      \"tags\": [\n        \"fashion\",\n        \"vip\"\n      ],\n      \"reason\": \"CRM sync\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateAccountPatch"},"example":{"country":"PT","tags":["fashion","vip"],"reason":"CRM sync"}}}}},"delete":{"operationId":"network_delete_affiliate_accounts_account_id","summary":"Remove an affiliate account (?dry_run=true previews)","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:delete"]}],"x-required-scope":"affiliate-accounts:delete","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean"},"description":"Preview what the removal does; nothing changes."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X DELETE \"https://api.example.com/api/v1/network/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Requested by the affiliate\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001\", {\n  method: \"DELETE\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Requested by the affiliate\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.delete(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Requested by the affiliate\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Requested by the affiliate"}}}}}},"/v1/network/affiliate-accounts/{account_id}/suspend":{"post":{"operationId":"network_post_affiliate_accounts_account_id_suspend","summary":"Pause an affiliate account, with a reason","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:suspend"]}],"x-required-scope":"affiliate-accounts:suspend","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/network/affiliate-accounts/5001/suspend\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Traffic quality review\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001/suspend\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Traffic quality review\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001/suspend\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Traffic quality review\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Traffic quality review"}}}}}},"/v1/network/affiliate-accounts/{account_id}/resume":{"post":{"operationId":"network_post_affiliate_accounts_account_id_resume","summary":"Resume a paused affiliate account, with a reason","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:suspend"]}],"x-required-scope":"affiliate-accounts:suspend","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/network/affiliate-accounts/5001/resume\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Review passed\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001/resume\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Review passed\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001/resume\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Review passed\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Review passed"}}}}}},"/v1/network/affiliate-accounts/{account_id}/users":{"get":{"operationId":"network_get_affiliate_accounts_account_id_users","summary":"The account's users and their roles","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/network/affiliate-accounts/5001/users\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001/users\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001/users\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]},"post":{"operationId":"network_post_affiliate_accounts_account_id_users","summary":"Invite a user to the account","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:invite"]}],"x-required-scope":"affiliate-accounts:invite","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/network/affiliate-accounts/5001/users\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ops@anadeals.example.com\",\n  \"role\": \"viewer\",\n  \"full_name\": \"Ops\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001/users\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ops@anadeals.example.com\",\n    \"role\": \"viewer\",\n    \"full_name\": \"Ops\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001/users\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ops@anadeals.example.com\",\n      \"role\": \"viewer\",\n      \"full_name\": \"Ops\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"ops@anadeals.example.com","role":"viewer","full_name":"Ops"}}}}}},"/v1/network/affiliate-accounts/{account_id}/users/resend-invite":{"post":{"operationId":"network_post_affiliate_accounts_account_id_users_resend_invite","summary":"Resend a pending invitation (the owner's or a user's)","tags":["Affiliate accounts (tk_ keys)"],"security":[{"networkKey":["affiliate-accounts:invite"]}],"x-required-scope":"affiliate-accounts:invite","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/network/affiliate-accounts/5001/users/resend-invite\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ana@example.com\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/network/affiliate-accounts/5001/users/resend-invite\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ana@example.com\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/network/affiliate-accounts/5001/users/resend-invite\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ana@example.com\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"ana@example.com"}}}}}},"/v1/subnetwork/affiliate-accounts":{"post":{"operationId":"subnetwork_post_affiliate_accounts","summary":"Create an affiliate account (Idempotency-Key required)","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:create"]}],"x-required-scope":"affiliate-accounts:create","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"$ref":"#/components/parameters/IdempotencyKeyRequired"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/subnetwork/affiliate-accounts\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ana@example.com\",\n  \"display_name\": \"Ana'\\''s Deals\",\n  \"legal_name\": \"Ana Deals Ltd\",\n  \"first_name\": \"Ana\",\n  \"last_name\": \"Silva\",\n  \"country\": \"GB\",\n  \"language\": \"en\",\n  \"currency\": \"EUR\",\n  \"phones\": [\n    {\n      \"number\": \"+44 20 7946 0000\",\n      \"label\": \"office\"\n    }\n  ],\n  \"website\": \"https://anadeals.example.com\",\n  \"properties\": [\n    {\n      \"type\": \"website\",\n      \"name\": \"Ana'\\''s Deals\",\n      \"url\": \"https://anadeals.example.com\",\n      \"soft_click\": true,\n      \"coupon_prefix\": \"ANA\"\n    }\n  ],\n  \"programmes\": [\n    {\n      \"brand_id\": 4001,\n      \"state\": \"invited\"\n    }\n  ],\n  \"tags\": [\n    \"fashion\"\n  ],\n  \"reason\": \"Onboarded from our CRM\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ana@example.com\",\n    \"display_name\": \"Ana's Deals\",\n    \"legal_name\": \"Ana Deals Ltd\",\n    \"first_name\": \"Ana\",\n    \"last_name\": \"Silva\",\n    \"country\": \"GB\",\n    \"language\": \"en\",\n    \"currency\": \"EUR\",\n    \"phones\": [\n      {\n        \"number\": \"+44 20 7946 0000\",\n        \"label\": \"office\"\n      }\n    ],\n    \"website\": \"https://anadeals.example.com\",\n    \"properties\": [\n      {\n        \"type\": \"website\",\n        \"name\": \"Ana's Deals\",\n        \"url\": \"https://anadeals.example.com\",\n        \"soft_click\": true,\n        \"coupon_prefix\": \"ANA\"\n      }\n    ],\n    \"programmes\": [\n      {\n        \"brand_id\": 4001,\n        \"state\": \"invited\"\n      }\n    ],\n    \"tags\": [\n      \"fashion\"\n    ],\n    \"reason\": \"Onboarded from our CRM\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ana@example.com\",\n      \"display_name\": \"Ana's Deals\",\n      \"legal_name\": \"Ana Deals Ltd\",\n      \"first_name\": \"Ana\",\n      \"last_name\": \"Silva\",\n      \"country\": \"GB\",\n      \"language\": \"en\",\n      \"currency\": \"EUR\",\n      \"phones\": [\n        {\n          \"number\": \"+44 20 7946 0000\",\n          \"label\": \"office\"\n        }\n      ],\n      \"website\": \"https://anadeals.example.com\",\n      \"properties\": [\n        {\n          \"type\": \"website\",\n          \"name\": \"Ana's Deals\",\n          \"url\": \"https://anadeals.example.com\",\n          \"soft_click\": True,\n          \"coupon_prefix\": \"ANA\"\n        }\n      ],\n      \"programmes\": [\n        {\n          \"brand_id\": 4001,\n          \"state\": \"invited\"\n        }\n      ],\n      \"tags\": [\n        \"fashion\"\n      ],\n      \"reason\": \"Onboarded from our CRM\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateAccountCreate"},"example":{"email":"ana@example.com","display_name":"Ana's Deals","legal_name":"Ana Deals Ltd","first_name":"Ana","last_name":"Silva","country":"GB","language":"en","currency":"EUR","phones":[{"number":"+44 20 7946 0000","label":"office"}],"website":"https://anadeals.example.com","properties":[{"type":"website","name":"Ana's Deals","url":"https://anadeals.example.com","soft_click":true,"coupon_prefix":"ANA"}],"programmes":[{"brand_id":4001,"state":"invited"}],"tags":["fashion"],"reason":"Onboarded from our CRM"}}}}},"get":{"operationId":"subnetwork_get_affiliate_accounts","summary":"List affiliate accounts (paged, filtered)","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"tag","in":"query","required":false,"schema":{"type":"string"}},{"name":"brand_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"programme_state","in":"query","required":false,"schema":{"type":"string"}},{"name":"email","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/subnetwork/affiliate-accounts\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]}},"/v1/subnetwork/affiliate-accounts/{account_id}":{"get":{"operationId":"subnetwork_get_affiliate_accounts_account_id","summary":"One affiliate account, with every detail","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]},"patch":{"operationId":"subnetwork_patch_affiliate_accounts_account_id","summary":"Change an affiliate account's details","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:update"]}],"x-required-scope":"affiliate-accounts:update","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X PATCH \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"country\": \"PT\",\n  \"tags\": [\n    \"fashion\",\n    \"vip\"\n  ],\n  \"reason\": \"CRM sync\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\", {\n  method: \"PATCH\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"country\": \"PT\",\n    \"tags\": [\n      \"fashion\",\n      \"vip\"\n    ],\n    \"reason\": \"CRM sync\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.patch(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"country\": \"PT\",\n      \"tags\": [\n        \"fashion\",\n        \"vip\"\n      ],\n      \"reason\": \"CRM sync\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateAccountPatch"},"example":{"country":"PT","tags":["fashion","vip"],"reason":"CRM sync"}}}}},"delete":{"operationId":"subnetwork_delete_affiliate_accounts_account_id","summary":"Remove an affiliate account (?dry_run=true previews)","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:delete"]}],"x-required-scope":"affiliate-accounts:delete","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean"},"description":"Preview what the removal does; nothing changes."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X DELETE \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Requested by the affiliate\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\", {\n  method: \"DELETE\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Requested by the affiliate\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.delete(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Requested by the affiliate\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Requested by the affiliate"}}}}}},"/v1/subnetwork/affiliate-accounts/{account_id}/suspend":{"post":{"operationId":"subnetwork_post_affiliate_accounts_account_id_suspend","summary":"Pause an affiliate account, with a reason","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:suspend"]}],"x-required-scope":"affiliate-accounts:suspend","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/suspend\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Traffic quality review\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/suspend\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Traffic quality review\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/suspend\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Traffic quality review\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Traffic quality review"}}}}}},"/v1/subnetwork/affiliate-accounts/{account_id}/resume":{"post":{"operationId":"subnetwork_post_affiliate_accounts_account_id_resume","summary":"Resume a paused affiliate account, with a reason","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:suspend"]}],"x-required-scope":"affiliate-accounts:suspend","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/resume\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Review passed\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/resume\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Review passed\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/resume\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Review passed\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Review passed"}}}}}},"/v1/subnetwork/affiliate-accounts/{account_id}/users":{"get":{"operationId":"subnetwork_get_affiliate_accounts_account_id_users","summary":"The account's users and their roles","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]},"post":{"operationId":"subnetwork_post_affiliate_accounts_account_id_users","summary":"Invite a user to the account","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:invite"]}],"x-required-scope":"affiliate-accounts:invite","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ops@anadeals.example.com\",\n  \"role\": \"viewer\",\n  \"full_name\": \"Ops\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ops@anadeals.example.com\",\n    \"role\": \"viewer\",\n    \"full_name\": \"Ops\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ops@anadeals.example.com\",\n      \"role\": \"viewer\",\n      \"full_name\": \"Ops\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"ops@anadeals.example.com","role":"viewer","full_name":"Ops"}}}}}},"/v1/subnetwork/affiliate-accounts/{account_id}/users/resend-invite":{"post":{"operationId":"subnetwork_post_affiliate_accounts_account_id_users_resend_invite","summary":"Resend a pending invitation (the owner's or a user's)","tags":["Affiliate accounts (snk_ keys)"],"security":[{"subnetworkKey":["affiliate-accounts:invite"]}],"x-required-scope":"affiliate-accounts:invite","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users/resend-invite\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ana@example.com\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users/resend-invite\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ana@example.com\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/subnetwork/affiliate-accounts/5001/users/resend-invite\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ana@example.com\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"ana@example.com"}}}}}},"/v1/advertiser/affiliate-accounts":{"post":{"operationId":"brand_post_affiliate_accounts","summary":"Create an affiliate account (Idempotency-Key required)","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:create"]}],"x-required-scope":"affiliate-accounts:create","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"$ref":"#/components/parameters/IdempotencyKeyRequired"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/advertiser/affiliate-accounts\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ana@example.com\",\n  \"display_name\": \"Ana'\\''s Deals\",\n  \"legal_name\": \"Ana Deals Ltd\",\n  \"first_name\": \"Ana\",\n  \"last_name\": \"Silva\",\n  \"country\": \"GB\",\n  \"language\": \"en\",\n  \"currency\": \"EUR\",\n  \"phones\": [\n    {\n      \"number\": \"+44 20 7946 0000\",\n      \"label\": \"office\"\n    }\n  ],\n  \"website\": \"https://anadeals.example.com\",\n  \"properties\": [\n    {\n      \"type\": \"website\",\n      \"name\": \"Ana'\\''s Deals\",\n      \"url\": \"https://anadeals.example.com\",\n      \"soft_click\": true,\n      \"coupon_prefix\": \"ANA\"\n    }\n  ],\n  \"programmes\": [\n    {\n      \"brand_id\": 4001,\n      \"state\": \"invited\"\n    }\n  ],\n  \"tags\": [\n    \"fashion\"\n  ],\n  \"reason\": \"Onboarded from our CRM\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ana@example.com\",\n    \"display_name\": \"Ana's Deals\",\n    \"legal_name\": \"Ana Deals Ltd\",\n    \"first_name\": \"Ana\",\n    \"last_name\": \"Silva\",\n    \"country\": \"GB\",\n    \"language\": \"en\",\n    \"currency\": \"EUR\",\n    \"phones\": [\n      {\n        \"number\": \"+44 20 7946 0000\",\n        \"label\": \"office\"\n      }\n    ],\n    \"website\": \"https://anadeals.example.com\",\n    \"properties\": [\n      {\n        \"type\": \"website\",\n        \"name\": \"Ana's Deals\",\n        \"url\": \"https://anadeals.example.com\",\n        \"soft_click\": true,\n        \"coupon_prefix\": \"ANA\"\n      }\n    ],\n    \"programmes\": [\n      {\n        \"brand_id\": 4001,\n        \"state\": \"invited\"\n      }\n    ],\n    \"tags\": [\n      \"fashion\"\n    ],\n    \"reason\": \"Onboarded from our CRM\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ana@example.com\",\n      \"display_name\": \"Ana's Deals\",\n      \"legal_name\": \"Ana Deals Ltd\",\n      \"first_name\": \"Ana\",\n      \"last_name\": \"Silva\",\n      \"country\": \"GB\",\n      \"language\": \"en\",\n      \"currency\": \"EUR\",\n      \"phones\": [\n        {\n          \"number\": \"+44 20 7946 0000\",\n          \"label\": \"office\"\n        }\n      ],\n      \"website\": \"https://anadeals.example.com\",\n      \"properties\": [\n        {\n          \"type\": \"website\",\n          \"name\": \"Ana's Deals\",\n          \"url\": \"https://anadeals.example.com\",\n          \"soft_click\": True,\n          \"coupon_prefix\": \"ANA\"\n        }\n      ],\n      \"programmes\": [\n        {\n          \"brand_id\": 4001,\n          \"state\": \"invited\"\n        }\n      ],\n      \"tags\": [\n        \"fashion\"\n      ],\n      \"reason\": \"Onboarded from our CRM\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateAccountCreate"},"example":{"email":"ana@example.com","display_name":"Ana's Deals","legal_name":"Ana Deals Ltd","first_name":"Ana","last_name":"Silva","country":"GB","language":"en","currency":"EUR","phones":[{"number":"+44 20 7946 0000","label":"office"}],"website":"https://anadeals.example.com","properties":[{"type":"website","name":"Ana's Deals","url":"https://anadeals.example.com","soft_click":true,"coupon_prefix":"ANA"}],"programmes":[{"brand_id":4001,"state":"invited"}],"tags":["fashion"],"reason":"Onboarded from our CRM"}}}}},"get":{"operationId":"brand_get_affiliate_accounts","summary":"List affiliate accounts (paged, filtered)","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"tag","in":"query","required":false,"schema":{"type":"string"}},{"name":"brand_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"programme_state","in":"query","required":false,"schema":{"type":"string"}},{"name":"email","in":"query","required":false,"schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/advertiser/affiliate-accounts\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]}},"/v1/advertiser/affiliate-accounts/{account_id}":{"get":{"operationId":"brand_get_affiliate_accounts_account_id","summary":"One affiliate account, with every detail","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]},"patch":{"operationId":"brand_patch_affiliate_accounts_account_id","summary":"Change an affiliate account's details","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:update"]}],"x-required-scope":"affiliate-accounts:update","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X PATCH \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"country\": \"PT\",\n  \"tags\": [\n    \"fashion\",\n    \"vip\"\n  ],\n  \"reason\": \"CRM sync\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\", {\n  method: \"PATCH\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"country\": \"PT\",\n    \"tags\": [\n      \"fashion\",\n      \"vip\"\n    ],\n    \"reason\": \"CRM sync\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.patch(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"country\": \"PT\",\n      \"tags\": [\n        \"fashion\",\n        \"vip\"\n      ],\n      \"reason\": \"CRM sync\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateAccountPatch"},"example":{"country":"PT","tags":["fashion","vip"],"reason":"CRM sync"}}}}},"delete":{"operationId":"brand_delete_affiliate_accounts_account_id","summary":"Remove an affiliate account (?dry_run=true previews)","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:delete"]}],"x-required-scope":"affiliate-accounts:delete","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean"},"description":"Preview what the removal does; nothing changes."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X DELETE \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Requested by the affiliate\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\", {\n  method: \"DELETE\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Requested by the affiliate\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.delete(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Requested by the affiliate\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Requested by the affiliate"}}}}}},"/v1/advertiser/affiliate-accounts/{account_id}/suspend":{"post":{"operationId":"brand_post_affiliate_accounts_account_id_suspend","summary":"Pause an affiliate account, with a reason","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:suspend"]}],"x-required-scope":"affiliate-accounts:suspend","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/suspend\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Traffic quality review\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/suspend\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Traffic quality review\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/suspend\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Traffic quality review\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Traffic quality review"}}}}}},"/v1/advertiser/affiliate-accounts/{account_id}/resume":{"post":{"operationId":"brand_post_affiliate_accounts_account_id_resume","summary":"Resume a paused affiliate account, with a reason","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:suspend"]}],"x-required-scope":"affiliate-accounts:suspend","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/resume\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"reason\": \"Review passed\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/resume\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"reason\": \"Review passed\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/resume\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"reason\": \"Review passed\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"reason":"Review passed"}}}}}},"/v1/advertiser/affiliate-accounts/{account_id}/users":{"get":{"operationId":"brand_get_affiliate_accounts_account_id_users","summary":"The account's users and their roles","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:read"]}],"x-required-scope":"affiliate-accounts:read","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X GET \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users\" \\\n  -H \"Authorization: Bearer $API_KEY\""},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}` },\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests\n\nres = requests.get(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n)\nout = res.json()"}]},"post":{"operationId":"brand_post_affiliate_accounts_account_id_users","summary":"Invite a user to the account","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:invite"]}],"x-required-scope":"affiliate-accounts:invite","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ops@anadeals.example.com\",\n  \"role\": \"viewer\",\n  \"full_name\": \"Ops\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ops@anadeals.example.com\",\n    \"role\": \"viewer\",\n    \"full_name\": \"Ops\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ops@anadeals.example.com\",\n      \"role\": \"viewer\",\n      \"full_name\": \"Ops\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"ops@anadeals.example.com","role":"viewer","full_name":"Ops"}}}}}},"/v1/advertiser/affiliate-accounts/{account_id}/users/resend-invite":{"post":{"operationId":"brand_post_affiliate_accounts_account_id_users_resend_invite","summary":"Resend a pending invitation (the owner's or a user's)","tags":["Affiliate accounts (mk_ keys)"],"security":[{"brandKey":["affiliate-accounts:invite"]}],"x-required-scope":"affiliate-accounts:invite","x-rate-limit":"10/second, 3000/hour per key","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"503":{"$ref":"#/components/responses/Error503"}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users/resend-invite\" \\\n  -H \"Authorization: Bearer $API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"email\": \"ana@example.com\"\n}'"},{"lang":"JavaScript","source":"const res = await fetch(\"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users/resend-invite\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.API_KEY}`, \"Idempotency-Key\": crypto.randomUUID(), \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"email\": \"ana@example.com\"\n  }),\n});\nconst out = await res.json();\nif (!res.ok) console.error(out.error.code, out.errors); // errors[] names each field"},{"lang":"Python","source":"import requests, uuid\n\nres = requests.post(\n    \"https://api.example.com/api/v1/advertiser/affiliate-accounts/5001/users/resend-invite\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\", \"Idempotency-Key\": str(uuid.uuid4())},\n    json={\n      \"email\": \"ana@example.com\"\n    },\n)\nout = res.json()"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"email":"ana@example.com"}}}}}}},"webhooks":{"affiliate_account.created":{"post":{"summary":"An affiliate account is created with your key.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"integer"},"status":{"type":"string"},"display_name":{"type":"string"},"changed_fields":{"type":"string","description":"Comma-separated field names (updated only)."},"occurred_at":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Acknowledge with any 2xx."}}}},"affiliate_account.updated":{"post":{"summary":"An account's details or status are changed with your key. changed_fields names what changed.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"integer"},"status":{"type":"string"},"display_name":{"type":"string"},"changed_fields":{"type":"string","description":"Comma-separated field names (updated only)."},"occurred_at":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Acknowledge with any 2xx."}}}},"affiliate_account.removed":{"post":{"summary":"An account is removed with your key (for a brand inside a network: removed from your program).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"integer"},"status":{"type":"string"},"display_name":{"type":"string"},"changed_fields":{"type":"string","description":"Comma-separated field names (updated only)."},"occurred_at":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Acknowledge with any 2xx."}}}}},"components":{"securitySchemes":{"networkKey":{"type":"http","scheme":"bearer","description":"A network tenant's API key (tk_…), from Developer › API keys in your console. Calls /v1/network/…"},"subnetworkKey":{"type":"http","scheme":"bearer","description":"A SubNetwork operator's API key (snk_…). Calls /v1/subnetwork/…"},"brandKey":{"type":"http","scheme":"bearer","description":"A brand's API key (mk_…). Calls /v1/advertiser/…"}},"parameters":{"IdempotencyKeyRequired":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"},"description":"Any unique string (a UUID). A retry with the same key and body returns the first answer (Idempotency-Replayed: true); the same key with another body is 409."},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional on this call; same replay rules."}},"schemas":{"AffiliateAccountCreate":{"type":"object","additionalProperties":false,"properties":{"email":{"type":"string","description":"The owner's login email. The account owner is invited to it (unless send_welcome_email is false). A SubNetwork operator may create an affiliate with no login. Not changed afterwards."},"display_name":{"type":"string","description":"The name the affiliate is shown by, kept as you chose it. At most 200 characters."},"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Legal or company name (the affiliate's billing details). At most 200 characters."},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The account holder's first name. At most 100 characters."},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The account holder's last name. At most 100 characters."},"notification_email":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Where notifications are sent, when not the login email."},"phones":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["number"]},"description":"Up to 10 phone numbers (digits, spaces, + ( ) . -). The first is the profile's phone number."},"im":{"type":"array","items":{"type":"object","properties":{"network":{"type":"string","enum":["whatsapp","telegram","signal","skype","wechat","line","viber","discord","slack","teams","other"]},"handle":{"type":"string"}},"required":["network","handle"]},"description":"Up to 10 instant-messaging handles. network: whatsapp, telegram, signal, skype, wechat, line, viber, discord, slack, teams, other."},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The affiliate's website (http or https)."},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2 country code, e.g. GB."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Preferred language, a BCP 47 tag: en, pt-BR."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Payout currency, ISO 4217: EUR."},"vat_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"VAT number, stored encrypted. At most 40 characters. Never returned: the account says only whether one is on file."},"sub_id":{"type":"string","description":"The affiliate's Sub-ID (letters, digits, - and _; up to 64). Generated when left out. Fixed once issued. For every other key the Sub-ID is assigned automatically and returned. (SubNetwork operator keys only.)"},"properties":{"type":"array","items":{"$ref":"#/components/schemas/PropertyInput"},"description":"Up to 50 promotional properties: {type, name, url, handle, store_id, description, audience_countries, audience_note, soft_click, coupon_prefix}. type is website, mobile_app, browser_extension, desktop_software, social_account, newsletter, messaging_channel or other; name is required, and the identifier the type needs (url, store_id or handle). coupon_prefix: 3-12 of A-Z 0-9 - _. On PATCH, name a property_id to change it, or add remove: true to retire it."},"registration_fields":{"type":"object","additionalProperties":true,"description":"Answers to your own registration fields, keyed by field id. Fields you made mandatory are required on create, exactly as on your sign-up form; a field hidden by its condition is not asked."},"commission_groups":{"type":"array","items":{"type":"object","properties":{"brand_id":{"type":"integer"},"group_id":{"type":"string","format":"uuid"}},"required":["group_id"]},"description":"Up to 50 commission groups to add the affiliate to, per brand. A brand key leaves brand_id out (its own)."},"programmes":{"type":"array","items":{"type":"object","properties":{"brand_id":{"type":"integer"},"state":{"type":"string","enum":["invited","approved","declined","removed"]},"group_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},"required":["state"]},"description":"The affiliate's place on a brand's program. state: invited, approved, declined, removed — the brand invites, and approves, declines or removes an application or membership, as in the console. pending is set by the affiliate applying. group_id goes with approved. A brand key leaves brand_id out (its own)."},"payout":{"type":"object","properties":{"method":{"anyOf":[{"type":"string","enum":["paypal","bank","wise"]},{"type":"null"}]},"details":{"anyOf":[{"type":"object"},{"type":"null"}]}},"description":"Payout method (paypal, bank, wise) and details (an object, stored encrypted). Accepted when you create the account, and until the owner first signs in; then they are the affiliate's to change. Never returned: the account says which method is on file and whether details are complete."},"notification_preferences":{"type":"object","additionalProperties":true,"description":"Per notification type, {\"email\": true|false, \"in_app\": true|false}. Always-on types cannot be switched off."},"tags":{"type":"array","items":{"type":"string"},"description":"Your private tags, up to 50, each 1-40 characters, stored lower-case. Each key family keeps its own: a brand's tags are its own, never the network's."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Your private note about the affiliate, up to 5000 characters. Never shown to the affiliate."},"status":{"type":"string","enum":["active","paused"],"description":"active or paused (default active). paused creates the account and pauses it with the create's reason. Afterwards, use …/suspend and …/resume. (create only.)"},"send_welcome_email":{"type":"boolean","description":"Send the owner their invitation (default true; for a SubNetwork operator default false, and only where your network settings let affiliates log in). (create only.)"},"users":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","full_access","basic_access","viewer","restricted_viewer"]},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","role"]},"description":"Up to 20 more people to invite to the account. role: admin, full_access, basic_access, viewer, restricted_viewer. Afterwards, use POST …/users. (create only.)"},"reason":{"type":"string","description":"Why the change is made, recorded in your Activity log. Required on create, suspend, resume and delete; optional on PATCH. At most 500 characters."}},"required":["display_name","reason"]},"AffiliateAccountPatch":{"type":"object","additionalProperties":false,"properties":{"display_name":{"type":"string","description":"The name the affiliate is shown by, kept as you chose it. At most 200 characters."},"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Legal or company name (the affiliate's billing details). At most 200 characters."},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The account holder's first name. At most 100 characters."},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The account holder's last name. At most 100 characters."},"notification_email":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Where notifications are sent, when not the login email."},"phones":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["number"]},"description":"Up to 10 phone numbers (digits, spaces, + ( ) . -). The first is the profile's phone number."},"im":{"type":"array","items":{"type":"object","properties":{"network":{"type":"string","enum":["whatsapp","telegram","signal","skype","wechat","line","viber","discord","slack","teams","other"]},"handle":{"type":"string"}},"required":["network","handle"]},"description":"Up to 10 instant-messaging handles. network: whatsapp, telegram, signal, skype, wechat, line, viber, discord, slack, teams, other."},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The affiliate's website (http or https)."},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2 country code, e.g. GB."},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Preferred language, a BCP 47 tag: en, pt-BR."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Payout currency, ISO 4217: EUR."},"vat_number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"VAT number, stored encrypted. At most 40 characters. Never returned: the account says only whether one is on file."},"properties":{"type":"array","items":{"$ref":"#/components/schemas/PropertyInput"},"description":"Up to 50 promotional properties: {type, name, url, handle, store_id, description, audience_countries, audience_note, soft_click, coupon_prefix}. type is website, mobile_app, browser_extension, desktop_software, social_account, newsletter, messaging_channel or other; name is required, and the identifier the type needs (url, store_id or handle). coupon_prefix: 3-12 of A-Z 0-9 - _. On PATCH, name a property_id to change it, or add remove: true to retire it."},"registration_fields":{"type":"object","additionalProperties":true,"description":"Answers to your own registration fields, keyed by field id. Fields you made mandatory are required on create, exactly as on your sign-up form; a field hidden by its condition is not asked."},"commission_groups":{"type":"array","items":{"type":"object","properties":{"brand_id":{"type":"integer"},"group_id":{"type":"string","format":"uuid"}},"required":["group_id"]},"description":"Up to 50 commission groups to add the affiliate to, per brand. A brand key leaves brand_id out (its own)."},"programmes":{"type":"array","items":{"type":"object","properties":{"brand_id":{"type":"integer"},"state":{"type":"string","enum":["invited","approved","declined","removed"]},"group_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},"required":["state"]},"description":"The affiliate's place on a brand's program. state: invited, approved, declined, removed — the brand invites, and approves, declines or removes an application or membership, as in the console. pending is set by the affiliate applying. group_id goes with approved. A brand key leaves brand_id out (its own)."},"payout":{"type":"object","properties":{"method":{"anyOf":[{"type":"string","enum":["paypal","bank","wise"]},{"type":"null"}]},"details":{"anyOf":[{"type":"object"},{"type":"null"}]}},"description":"Payout method (paypal, bank, wise) and details (an object, stored encrypted). Accepted when you create the account, and until the owner first signs in; then they are the affiliate's to change. Never returned: the account says which method is on file and whether details are complete."},"notification_preferences":{"type":"object","additionalProperties":true,"description":"Per notification type, {\"email\": true|false, \"in_app\": true|false}. Always-on types cannot be switched off."},"tags":{"type":"array","items":{"type":"string"},"description":"Your private tags, up to 50, each 1-40 characters, stored lower-case. Each key family keeps its own: a brand's tags are its own, never the network's."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Your private note about the affiliate, up to 5000 characters. Never shown to the affiliate."},"reason":{"type":"string","description":"Why the change is made, recorded in your Activity log. Required on create, suspend, resume and delete; optional on PATCH. At most 500 characters."}}},"AffiliateAccount":{"type":"object","properties":{"account_id":{"type":"integer"},"status":{"anyOf":[{"type":"string","enum":["active","pending","paused","declined"]},{"type":"null"}]},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"notification_email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phones":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["number"]}},"im":{"type":"array","items":{"type":"object","properties":{"network":{"type":"string","enum":["whatsapp","telegram","signal","skype","wechat","line","viber","discord","slack","teams","other"]},"handle":{"type":"string"}},"required":["network","handle"]}},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"language":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"vat_number_on_file":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"sub_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"properties":{"type":"array","items":{"type":"object","properties":{"property_id":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}]},"handle":{"anyOf":[{"type":"string"},{"type":"null"}]},"store_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"soft_click":{"type":"boolean"},"coupon_prefix":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"}}}},"registration_fields":{"anyOf":[{"type":"object"},{"type":"null"}]},"programmes":{"type":"array","items":{"type":"object","properties":{"brand_id":{"anyOf":[{"type":"integer"},{"type":"null"}]},"state":{"type":"string","enum":["invited","pending","approved","declined","removed"]}}}},"commission_groups":{"type":"array","items":{"type":"object","properties":{"group_id":{"type":"string"},"name":{"type":"string"}}}},"payout":{"anyOf":[{"type":"object","properties":{"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"details_on_file":{"type":"boolean"},"complete":{"type":"boolean"}}},{"type":"null"}]},"tax_form":{"anyOf":[{"type":"object","properties":{"collected":{"type":"boolean"},"form_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]}}},{"type":"null"}]},"notification_preferences":{"anyOf":[{"type":"object"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"users":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"role":{"type":"string"},"status":{"type":"string","enum":["active","invited"]},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}]}}}},{"type":"null"}]},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"PropertyInput":{"type":"object","properties":{"property_id":{"type":"string","format":"uuid","description":"PATCH only: the property to change or remove."},"remove":{"type":"boolean","description":"PATCH only: retire the property."},"type":{"type":"string","enum":["website","mobile_app","browser_extension","desktop_software","social_account","newsletter","messaging_channel","other"]},"name":{"type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}]},"handle":{"anyOf":[{"type":"string"},{"type":"null"}]},"store_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"audience_countries":{"type":"array","items":{"type":"string"}},"audience_note":{"anyOf":[{"type":"string"},{"type":"null"}]},"soft_click":{"type":"boolean"},"coupon_prefix":{"anyOf":[{"type":"string","pattern":"^[A-Za-z0-9_-]{3,12}$"},{"type":"null"}]}}},"Envelope":{"type":"object","properties":{"data":{},"request_id":{"type":"string"}}},"FieldError":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string","enum":["required","invalid","unknown_field","read_only","not_allowed","too_long","too_many","not_available"]},"message":{"type":"string"}},"required":["field","code","message"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}},"required":["code","message","request_id"]},"errors":{"type":"array","items":{"$ref":"#/components/schemas/FieldError"}}},"required":["error"]}},"responses":{"Error400":{"description":"invalid_parameter: A query parameter is unknown or malformed (named in error.parameter and errors[]). idempotency_key_required: POST …/affiliate-accounts without an Idempotency-Key header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error401":{"description":"unauthorized: The key is missing, invalid, expired, revoked — or of a kind this path does not take.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error403":{"description":"insufficient_scope: The key lacks the one scope this action needs. forbidden: The act is not the key's to make, e.g. a brand inside a network changing an account-wide detail (errors[] names the field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error404":{"description":"not_found: No account with that account_id in your scope (another tenant's, brand's or instance's affiliate answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error409":{"description":"conflict: A duplicate (email in your tenant, Sub-ID), a state that does not allow the act, or an Idempotency-Key reused with a different body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error422":{"description":"validation_error: The body is invalid. errors[] lists EVERY field that is wrong: {field, code, message}, field a path like properties[2].coupon_prefix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error429":{"description":"rate_limited: Over 10/second or 3000/hour for this key. Retry after the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error503":{"description":"service_unavailable: A dependency could not be read; nothing was changed. Retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}