API reference · tag affiliates
Affiliates
Matching and ingestion of the entity’s affiliate base: by JSON batch, by file, and lookup by document.
This page is generated from the contract (data/gateway-v1.json): each operation shows its verb,
path, parameters, body, responses, whether it carries an Idempotency-Key, and the equivalent method in all five SDKs.
For the end-to-end flow with complete examples, see the implementation guide.
Operations in tag affiliates #
Contract description: Affiliate base cross-check, ingestion and file upload.
| Method | Path | Operation | Scope | Idem. |
|---|---|---|---|---|
| POST | /v1/gateway/affiliates/ | Cross / register the affiliate base | affiliates:upsert | recommended |
| POST | /v1/gateway/affiliates/upload/ | Upload affiliates from a file (CSV / Excel) | affiliates:upsert | recommended |
| GET | /v1/gateway/affiliates/{document}/ | Cross-check an affiliate by document | affiliates:read | — |
Cross / register the affiliate base #
POST/v1/gateway/affiliates/
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Key | header | string | Client-generated key that makes a write safely retryable. Replaying the same key returns the original result with idempotent_replay: true; a replay while the original is still in flight returns 409. E.g.: horizonte-2026-06-26-credit-000123 |
Request body
Content type: application/json · required
List (array) of AffiliateRecordIn
.
Responses
| Code | Description | Body |
|---|---|---|
| 200 | Batch processed. | TransactionEnvelope
application/json |
Possible errors (400, 401, 403, 404, 409, 422, 429, 500, 502) — application/problem+json
| 400 | Malformed request. | about:blank |
| 401 | Missing or invalid API key. | about:blank |
| 403 | The key is valid but lacks the required scope, or the source IP is not allow-listed. | about:blank |
| 404 | The requested resource does not exist. | about:blank |
| 409 | Idempotency conflict — same key, original still processing. | https://errors.compense.co/gateway/idempotency-conflict |
| 422 | Request body failed validation. | https://errors.compense.co/gateway/validation |
| 429 | Per-key rate limit or monthly quota exceeded; see Retry-After. | https://errors.compense.co/gateway/rate-limited |
| 500 | Unexpected gateway error; quote the trace_id to support. | about:blank |
| 502 | The processing engine returned an error. | https://errors.compense.co/gateway/upstream-error |
See problem+json errors for the equivalent exception in each SDK.
Example
client.affiliates.cross()client.affiliates.cross()$client->affiliates->cross()await client.Affiliates.CrossAsync()client.Affiliates.Cross(ctx, …)curl -X POST "https://sandbox.dev.compense.co/gw/v1/gateway/affiliates/" \
-H "X-API-Key: $COMPENSE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '[
{
"document_type": "CC",
"document_number": "1032456789",
"first_name": "María",
"last_name": "Gómez",
"email": "maria.gomez@example.co",
"category": "A"
}
]'Each SDK's methods come from its contract parity suite. The cURL runs against the sandbox; <field> values are placeholders.
Upload affiliates from a file (CSV / Excel) #
POST/v1/gateway/affiliates/upload/
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Key | header | string | Client-generated key that makes a write safely retryable. Replaying the same key returns the original result with idempotent_replay: true; a replay while the original is still in flight returns 409. E.g.: horizonte-2026-06-26-credit-000123 |
Request body
Content type: multipart/form-data · required
| Field | Type | Description |
|---|---|---|
file required | string (binary) | CSV or XLSX, max 25 MB. |
Responses
| Code | Description | Body |
|---|---|---|
| 200 | File parsed and batch processed. | TransactionEnvelope
application/json |
Possible errors (400, 401, 403, 404, 409, 422, 429, 500, 502) — application/problem+json
| 400 | Malformed request. | about:blank |
| 401 | Missing or invalid API key. | about:blank |
| 403 | The key is valid but lacks the required scope, or the source IP is not allow-listed. | about:blank |
| 404 | The requested resource does not exist. | about:blank |
| 409 | Idempotency conflict — same key, original still processing. | https://errors.compense.co/gateway/idempotency-conflict |
| 422 | Request body failed validation. | https://errors.compense.co/gateway/validation |
| 429 | Per-key rate limit or monthly quota exceeded; see Retry-After. | https://errors.compense.co/gateway/rate-limited |
| 500 | Unexpected gateway error; quote the trace_id to support. | about:blank |
| 502 | The processing engine returned an error. | https://errors.compense.co/gateway/upstream-error |
See problem+json errors for the equivalent exception in each SDK.
Example
client.affiliates.upload()client.affiliates.upload()$client->affiliates->upload()await client.Affiliates.UploadAsync()client.Affiliates.Upload(ctx, …)curl -X POST "https://sandbox.dev.compense.co/gw/v1/gateway/affiliates/upload/" \
-H "X-API-Key: $COMPENSE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-F "file=@afiliados.csv"Each SDK's methods come from its contract parity suite. The cURL runs against the sandbox; <field> values are placeholders.
Cross-check an affiliate by document #
GET/v1/gateway/affiliates/{document}/
Parameters
| Name | In | Type | Description |
|---|---|---|---|
document required | path | string | National document number. E.g.: 1032456789 |
Responses
| Code | Description | Body |
|---|---|---|
| 200 | Affiliate found. | AffiliateLookup
application/json |
Possible errors (400, 401, 403, 404, 409, 422, 429, 500, 502) — application/problem+json
| 400 | Malformed request. | about:blank |
| 401 | Missing or invalid API key. | about:blank |
| 403 | The key is valid but lacks the required scope, or the source IP is not allow-listed. | about:blank |
| 404 | The requested resource does not exist. | about:blank |
| 409 | Idempotency conflict — same key, original still processing. | https://errors.compense.co/gateway/idempotency-conflict |
| 422 | Request body failed validation. | https://errors.compense.co/gateway/validation |
| 429 | Per-key rate limit or monthly quota exceeded; see Retry-After. | https://errors.compense.co/gateway/rate-limited |
| 500 | Unexpected gateway error; quote the trace_id to support. | about:blank |
| 502 | The processing engine returned an error. | https://errors.compense.co/gateway/upstream-error |
See problem+json errors for the equivalent exception in each SDK.
Example
client.affiliates.get()client.affiliates.get()$client->affiliates->get()await client.Affiliates.GetAsync()client.Affiliates.Get(ctx, …)curl "https://sandbox.dev.compense.co/gw/v1/gateway/affiliates/1032456789/" \
-H "X-API-Key: $COMPENSE_API_KEY"Each SDK's methods come from its contract parity suite. The cURL runs against the sandbox; <field> values are placeholders.