Affiliates API¶
This section details the API endpoints for managing affiliate records associated with your company.
Endpoint: /affiliates
Base URL: https://app.integrishield.com/api
List Affiliates¶
- Method:
GET - Full Endpoint:
https://app.integrishield.com/api/affiliates - Description: Retrieves a paginated list of affiliates for your company. Supports filtering by status, country, and date range.
- Authentication: Required (Bearer Token).
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
status |
string | No | Filter by affiliate status (e.g., Active, Inactive, Probation, Suspended, Terminated). |
country |
integer | No | Filter by country ID. |
created_after |
date | No | Return affiliates with a start date on or after this date (format: YYYY-MM-DD). |
created_before |
date | No | Return affiliates with a start date on or before this date (format: YYYY-MM-DD). |
sort_by |
string | No | Field to sort by. Allowed values: id, distributor_name, start_date, distributor_status. Default: id. |
sort_dir |
string | No | Sort direction. Allowed values: asc, desc. Default: desc. |
per_page |
integer | No | Number of results per page. Min: 1. Max: 200. Default: 100. |
page |
integer | No | Page number to retrieve. Default: 1. |
Example Request:
GET /api/affiliates?status=Active&created_after=2024-01-01&per_page=50&sort_by=distributor_name&sort_dir=asc
Success Response (200 OK):
Returns a JSON object containing the affiliates data and pagination metadata.
{
"code": "1026",
"status": "ok",
"detail": {
"msg": "Affiliates found"
},
"data": [
{
"id": 126,
"client_affiliate_id": "YOUR-AFF-ID-001",
"affiliate_name": "Affiliate One Name",
"case_count": 3,
"email_one": "affiliate.one@example.com",
"email_two": null,
"email_three": null,
"email_four": null,
"email_five": null,
"additional_emails": ["backup@example.com"],
"phone_one": "555-123-4567",
"phone_two": null,
"facebook": "https://facebook.com/affiliate1",
"instagram": "@affiliate1",
"youtube": null,
"twitter": null,
"tiktok": null,
"pintrest": null,
"country": "United States",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zip": "10001",
"first_name": "John",
"last_name": "Smith",
"status": "Active",
"ranking": "Gold",
"is_upline": 0,
"merchant_type": "Affiliate",
"language_used": "English",
"territory": "Northeast",
"pay_rank": "Gold",
"recognition_rank": "Top Seller",
"upline_id": 100,
"upline_name": "Mary Johnson",
"manager_id": 50,
"manager_name": "Jane Doe",
"sponsor": "SP456",
"sponsor_id": "SP-001",
"sponsor_email": "sponsor@example.com",
"replicated_website": "https://johnsmith.company.com",
"notes": "VIP distributor",
"start_date": "2022-01-15",
"last_updated_date": "2024-03-15 10:30:00"
}
],
"meta": {
"total": 150,
"per_page": 50,
"current_page": 1,
"last_page": 3
}
}
Response Fields:
code(string): Response code.1026indicates success.status(string):okfor successful requests.detail.msg(string): Human-readable status message.data(array): Array of affiliate objects (see Affiliate Object Reference below).meta(object): Pagination information.total(integer): Total number of affiliates matching the query.per_page(integer): Number of results per page.current_page(integer): Current page number.last_page(integer): Total number of pages.
Get Single Affiliate¶
- Method:
GET - Full Endpoint:
https://app.integrishield.com/api/affiliates/{id} - Description: Retrieves detailed information for a specific affiliate by their unique Integrishield ID.
- Authentication: Required (Bearer Token).
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | The unique ID assigned by Integrishield (found via List or Create responses). |
Example Request:
GET /api/affiliates/126
Success Response (200 OK):
Returns a JSON object containing the affiliate data.
{
"code": "1026",
"status": "ok",
"detail": {
"msg": "Affiliate found"
},
"data": {
"id": 126,
"client_affiliate_id": "YOUR-AFF-ID-001",
"affiliate_name": "Affiliate One Name",
"case_count": 3,
...
}
}
Error Response (404 Not Found):
Returned if no affiliate exists with the specified ID, or the affiliate does not belong to your company.
{
"code": "1025",
"status": "error",
"detail": {
"msg": "Affiliate not found."
}
}
Create Affiliate(s)¶
- Method:
POST - Full Endpoint:
https://app.integrishield.com/api/affiliates - Description: Creates one or more new affiliates for your company. Supports single or batch creation. Duplicates based on
affiliate_namewithin your company are skipped. - Authentication: Required (Bearer Token).
Request Body (Single Affiliate):
A JSON object with the affiliate's details. client_affiliate_id and affiliate_name are required. See the Affiliate Data Fields reference for all available fields.
{
"client_affiliate_id": "YOUR-AFF-ID-003",
"affiliate_name": "New Affiliate Three",
"email_one": "new.three@example.com",
"country": "US",
"status": "active"
}
Request Body (Multiple Affiliates):
A JSON object with a single key affiliates containing an array of affiliate objects. client_affiliate_id and affiliate_name are required within each object.
{
"affiliates": [
{
"client_affiliate_id": "YOUR-MULTI-1",
"affiliate_name": "Multi Affiliate One",
"country": "CA",
"status": "active"
},
{
"client_affiliate_id": "YOUR-MULTI-2",
"affiliate_name": "Multi Affiliate Two",
"status": "inactive"
}
]
}
Success Response (Single - 201 Created):
Confirms creation and returns the full affiliate record.
{
"code": "1020",
"status": "ok",
"detail": {
"msg": "Affiliate added successfully."
},
"data": {
"id": 126,
"client_affiliate_id": "YOUR-AFF-ID-003",
"affiliate_name": "New Affiliate Three",
"case_count": 0,
...
}
}
Success Response (Multiple - 201 Created or 207 Multi-Status):
Returns a JSON array with results for each submitted affiliate. HTTP status is 201 if all succeed, 207 if there are mixed results (successes and handled errors like duplicates).
[
{
"code": "1020",
"status": "ok",
"detail": {
"msg": "Affiliate added successfully."
},
"data": {
"id": 127,
"client_affiliate_id": "YOUR-MULTI-1",
"affiliate_name": "Multi Affiliate One",
...
}
},
{
"code": "1023",
"status": "error",
"detail": {
"client_affiliate_id": "YOUR-MULTI-2",
"msg": "`Affiliate Name` already exists."
}
}
]
Error Responses:
- 409 Conflict: (Single Create Only) If an affiliate with the same
affiliate_namealready exists. - 422 Unprocessable Entity: If validation fails (missing required fields, invalid formats, etc.). Check the
errorsobject in the response body for details on which fields failed and why.
Update Affiliate(s)¶
- Method:
PUT - Full Endpoint:
https://app.integrishield.com/api/affiliates/{id} - Description: Updates one or more existing affiliates.
- Single Update: Use the affiliate's unique Integrishield ID in the URL (
{id}). The request body MUST also contain anidfield with the same value. - Multiple Update: Use any valid affiliate ID in the URL (it's ignored). The request body MUST contain an
affiliatesarray, and each object within that array MUST have theid(Integrishield ID) of the affiliate to update.
- Single Update: Use the affiliate's unique Integrishield ID in the URL (
- Authentication: Required (Bearer Token).
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | The unique Integrishield ID (required for single update; ignored for bulk updates). |
Request Body (Single Affiliate Update):
JSON object with fields to update. Must include id matching the URL. See the Affiliate Data Fields reference for all available fields.
{
"id": 126,
"affiliate_name": "Updated Affiliate Name",
"status": "probation",
"notes": "Account under review.",
"pay_rank": "Bronze"
}
Request Body (Multiple Affiliates Update):
JSON object with an affiliates array. Each object must include id (Integrishield ID) and the fields to update for that specific affiliate.
{
"affiliates": [
{
"id": 127,
"status": "terminated",
"notes": "Account terminated due to violation."
},
{
"id": 128,
"affiliate_name": "Affiliate Renamed Ltd.",
"phone_one": "555-111-2222",
"pay_rank": "Platinum"
}
]
}
Success Response (Single - 200 OK):
Returns the updated affiliate record.
{
"code": "1020",
"status": "ok",
"detail": {
"msg": "Affiliate updated successfully."
},
"data": {
"id": 126,
"client_affiliate_id": "YOUR-AFF-ID-003",
"affiliate_name": "Updated Affiliate Name",
"case_count": 3,
...
}
}
Success Response (Multiple - 200 OK or 207 Multi-Status):
Returns a JSON array with results for each submitted update attempt. HTTP status is 200 if all succeed, 207 if there are mixed results.
[
{
"code": "1020",
"status": "ok",
"detail": {
"msg": "Affiliate updated successfully."
},
"data": {
"id": 127,
"client_affiliate_id": "YOUR-MULTI-1",
...
}
},
{
"code": "1025",
"status": "error",
"detail": {
"affiliate_id": 999,
"msg": "Affiliate not found against the provided Affiliate-ID."
}
}
]
Error Responses:
- 404 Not Found: (Single Update Only) If the affiliate ID in the URL doesn't exist or belong to your company.
- 422 Unprocessable Entity: If validation fails (e.g.,
idmissing in payload, invalid field formats). Check theerrorsobject in the response body for details.
Affiliate Object Reference¶
Each affiliate object in the response contains the following fields:
Identity & Status¶
| Field | Type | Description |
|---|---|---|
id |
integer | Unique identifier assigned by Integrishield. |
client_affiliate_id |
string|null | Your unique identifier for the affiliate. |
affiliate_name |
string|null | Name of the affiliate. |
first_name |
string|null | Affiliate's first name. |
last_name |
string|null | Affiliate's last name. |
case_count |
integer | Number of compliance cases associated with this affiliate. |
status |
string|null | Current status of the affiliate (e.g., "Active", "Inactive", "Suspended"). |
ranking |
string|null | Affiliate's ranking. |
is_upline |
integer | Whether this affiliate is an upline (1 = yes, 0 = no). |
merchant_type |
string|null | Type of merchant/affiliate. |
language_used |
string|null | Primary language used by the affiliate. |
territory |
string|null | Assigned territory. |
pay_rank |
string|null | Affiliate's pay rank. |
recognition_rank |
string|null | Affiliate's recognition rank. |
Contact & Social¶
| Field | Type | Description |
|---|---|---|
email_one |
string|null | Primary email address. |
email_two |
string|null | Secondary email address. |
email_three |
string|null | Third email address. |
email_four |
string|null | Fourth email address. |
email_five |
string|null | Fifth email address. |
additional_emails |
array|null | Additional email addresses. |
phone_one |
string|null | Primary phone number. |
phone_two |
string|null | Secondary phone number. |
facebook |
string|null | Facebook profile/page URL. |
instagram |
string|null | Instagram profile URL/handle. |
youtube |
string|null | YouTube channel/profile URL. |
twitter |
string|null | Twitter/X profile URL/handle. |
tiktok |
string|null | TikTok profile URL/handle. |
pintrest |
string|null | Pinterest profile URL/handle. |
replicated_website |
string|null | Affiliate's replicated website URL. |
Location¶
| Field | Type | Description |
|---|---|---|
country |
string|null | Country name (resolved from country code). |
address |
string|null | Street address. |
city |
string|null | City. |
state |
string|null | State/province. |
zip |
string|null | Postal/ZIP code. |
Affiliate Hierarchy¶
| Field | Type | Description |
|---|---|---|
upline_id |
integer|null | ID of the upline affiliate. |
upline_name |
string|null | Name of the upline affiliate. |
manager_id |
integer|null | ID of the managing affiliate. Read-only; not settable via the API. |
manager_name |
string|null | Name of the managing affiliate. Read-only. |
sponsor |
string|null | Sponsor name or identifier. |
sponsor_id |
string|null | Sponsor's ID. |
sponsor_email |
string|null | Sponsor's email address. |
Notes & Dates¶
| Field | Type | Description |
|---|---|---|
notes |
string|null | Internal notes about the affiliate. |
start_date |
date|null | Affiliate start date. |
last_updated_date |
datetime|null | When the affiliate record was last updated. |
Affiliate Data Fields¶
The following table lists the fields available when creating or updating affiliates via the API. Use these field names in your JSON request bodies.
| Field | Type | Required (Create) | Description | Max Length | Validation Notes |
|---|---|---|---|---|---|
client_affiliate_id |
string | Yes | Your unique identifier for the affiliate. | 64 | |
affiliate_name |
string | Yes | Name of the affiliate. | 128 | Must be unique within your company. |
email_one |
string | No | Primary email address. | 50 | Must be a valid email format. |
email_two |
string | No | Secondary email address. | 50 | Must be a valid email format. |
email_three |
string | No | Third email address. | 50 | Must be a valid email format. |
email_four |
string | No | Fourth email address. | 50 | Must be a valid email format. |
email_five |
string | No | Fifth email address. | 50 | Must be a valid email format. |
additional_emails |
array | No | Additional email addresses. | - | Array of valid email strings (max 255 chars each). |
phone_one |
string | No | Primary phone number. | 30 | |
phone_two |
string | No | Secondary phone number. | 128 | |
facebook |
string | No | Facebook profile/page URL. | 128 | |
instagram |
string | No | Instagram profile URL/handle. | 255 | |
youtube |
string | No | YouTube channel/profile URL. | 128 | |
twitter |
string | No | Twitter profile URL/handle. | 64 | |
tiktok |
string | No | TikTok profile URL/handle. | 64 | |
pintrest |
string | No | Pinterest profile URL/handle. | 64 | |
country |
string | No | ISO 2-letter country code (e.g., "US", "CA", "GB"). | 2 | Must be exactly 2 characters. |
first_name |
string | No | Affiliate's first name. | 128 | |
last_name |
string | No | Affiliate's last name. | 64 | |
notes |
string | No | Internal notes about the affiliate. | 2048 | |
address |
string | No | Street address. | 512 | |
city |
string | No | City name. | 64 | |
state |
string | No | State or province name/code. | 64 | |
zip |
string | No | Postal code / ZIP code. | 16 | |
ranking |
string | No | Affiliate's ranking. | 64 | |
replicated_website |
string | No | URL of the affiliate's replicated website. | 256 | Must be a valid URL format. |
sponsor |
string | No | Name of the affiliate's sponsor. | 64 | |
upline |
string | No | Integrishield id of the affiliate's upline affiliate. Returned as upline_id / upline_name. |
255 | |
status |
string | No | Current status of the affiliate. | - | Must be one of: active, inactive, probation, suspended, terminated, forgotten. |
start_date |
string | No | Affiliate start date (format: YYYY-MM-DD or MM/DD/YYYY). |
10 | |
language_used |
string | No | Primary language used by the affiliate. | 64 | |
territory |
string | No | Assigned territory. | 64 | |
merchant_type |
string | No | Type of merchant, if applicable. | 255 | |
sponsor_id |
string | No | ID of the affiliate's sponsor. | 64 | |
sponsor_email |
string | No | Email address of the affiliate's sponsor. | 255 | Must be a valid email format. |
pay_rank |
string | No | Affiliate's pay rank. | 64 | |
recognition_rank |
string | No | Affiliate's recognition rank. | 64 |
Common Error Responses¶
-
401 Unauthorized: If the Bearer token is missing, invalid, or expired.
-
429 Too Many Requests: If you exceed the API rate limit. Wait before retrying.
-
500 Internal Server Error: If an unexpected error occurs on the server during processing.
{
"code": "500",
"status": "error",
"detail": {
"msg": "Server error! Contact server admin."
}
}