# Get Client Integrations

<mark style="color:blue;">`GET`</mark> `/v2/settings/clientintegrations`

This endpoint retrieves a list of **client integrations**, representing schools that have authorized your integration in their d6+ SAMS instance.

Each record in the response corresponds to a unique **client/API type combination**, meaning a single school may appear multiple times if it has authorized multiple integrations.

### Pagination

The response data includes a `meta` object that contains **pagination-specific metadata**. You can use the following query parameters to **control pagination**:

* **limit**: This parameter allows you to override the default limit of records returned, up to the `max_allowed_limit` specified in the response's `meta` object.
* **cursor**: If the `meta` object contains a `next_cursor` field, it indicates that more records are available. To fetch the next set of records, include the `cursor` parameter in your request with the value of `next_cursor`. If the `next_cursor` field is not present, it means there are no more records to retrieve.
* **reverse\_order**: This parameter can be used to reverse the order in which the data is returned, useful for fetching the latest records first.

### Request Headers

| Name                                                | Type   | Description       |
| --------------------------------------------------- | ------ | ----------------- |
| `HTTP-X-USERNAME`<mark style="color:red;">\*</mark> | String | As provided by d6 |
| `HTTP-X-PASSWORD`<mark style="color:red;">\*</mark> | String | As provided by d6 |

### Query Parameters

<table><thead><tr><th width="187.142822265625">Name</th><th width="135.62860107421875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>school_id</code></td><td>Integer</td><td>Optional ID of the school to retrieve data from</td></tr><tr><td><code>api_type_id</code></td><td>Integer</td><td>For filtering on a specific API Type</td></tr><tr><td><code>cursor</code></td><td>Boolean</td><td>To retrieve the next group of items (if any)</td></tr><tr><td><code>limit</code></td><td>Integer</td><td>To override the default limit of records returned (up to the <code>max_allowed_limit</code> provided in the response metadata).</td></tr><tr><td><code>reverse_order</code></td><td>Boolean</td><td>To reverse the order the data is returned in</td></tr></tbody></table>

### Response Examples

{% tabs %}
{% tab title="Success (200 OK)" %}
**Status:** <mark style="color:green;">`200 OK`</mark>

```json
[
    "data": [
        {
            "school_id": 1000,
            "school_name": "d6+ Primary School",
            "admin_email_address": "support@d6plus.co.za",
            "telephone_calling_code": "27",
            "telephone_number": "0123334444",
            "api_type_id": 8,
            "api_type": "Admin+ API",
            "activated_by_integrator": "No"
        },
        {
            "school_id": 1000,
            "school_name": "d6+ Primary School",
            "admin_email_address": "support@d6plus.co.za",
            "telephone_calling_code": "27",
            "telephone_number": "0123334444",
            "api_type_id": 9,
            "api_type": "Curriculum+ API",
            "activated_by_integrator": "Yes"
        },
        {
            "school_id": 1001,
            "school_name": "d6+ Secondary School",
            "admin_email_address": "support@d6plus.co.za",
            "telephone_calling_code": "27",
            "telephone_number": "0123334444",
            "api_type_id": 8,
            "api_type": "Debt manager",
            "activated_by_integrator": "Yes"
        }
    ],
    "meta": {
        "limit": 10,
        "max_allowed_limit": 50,
        "cursor": "eyJpZCI6MjU0NiwiX2JhY2t3YXJkIjpmYWxzZX0"
    }
]
```

{% endtab %}

{% tab title="Validation Error (400 Bad Request)" %}
**Description:** When validation failed for one or more fields

**Status:** <mark style="color:red;">`400 Bad Request`</mark>

```json
{
    "success": false,
    "message": "Validation Failed",
    "validation_errors": {
        "school_id": "The School id must be integer",
        "api_type_id": "The Api type id must be integer",
        "limit": "The Limit maximum is 50"
    }
}
```

{% endtab %}
{% endtabs %}

### Code Samples

{% tabs %}
{% tab title="PHP" %}

```php
<?php

// API Credentials
$api_username = 'your_username';
$api_password = 'your_password';

// Base API endpoint
define('BASE_URL', 'https://integrate.d6plus.co.za/api/v2/settings/clientintegrations');

// Query parameters (optional)
$query_params = [
    'school_id'   => 1000,
    'api_type_id' => 8,
    'limit'       => 50,
    'cursor'      => 'eyJpZCI6MTY5NCwiX2JhY2t3YXJkIjpmYWxzZX0',
];

$url = BASE_URL;
if (!empty($query_params)) {
    $url .= '?' . http_build_query($query_params);
}

// Initialize cURL
$curl = curl_init();

// Set cURL options
curl_setopt_array($curl, [
    CURLOPT_URL            => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 30,  // Set timeout to prevent hanging requests
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION   => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST  => 'GET',
    CURLOPT_HTTPHEADER     => [
        "HTTP-X-USERNAME: $api_username",
        "HTTP-X-PASSWORD: $api_password"
    ],
]);

// Execute request
$response = curl_exec($curl);

// Check for errors
$error = curl_error($curl);
if ($error) {
    curl_close($curl);
    throw new Exception("cURL Error: $error");
}

// Close cURL and output response
curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="cURL" %}

```bash
curl --request GET "https://integrate.d6plus.co.za/api/v2/settings/clientintegrations?school_id=1000&api_type_id=8&limit=50" \
     --header "HTTP-X-USERNAME: your_username" \
     --header "HTTP-X-PASSWORD: your_password"
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.d6plus.co.za/v2/reference/settings/client-integrations/get-client-integrations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
