# List API Endpoints

## Endpoint Description <a href="#endpoint-description" id="endpoint-description"></a>

The **List API Programs** endpoint provides the list of endpoints available within V2 oft the API.

## HTTP Method

**GET** `/api/v2/system/endpoints`

## **Request**

### **Headers:**

* **Content-Type:** `application/json` - Specifies that the request body format is JSON.
* **Accept:** `application/json` - Indicates that the client expects a JSON response.
* **Authorization:** `Bearer {token}` - A valid Bearer token must be provided to authenticate the request.

### **Request Examples**

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

```bash
curl --request GET \
    --get "http://r1discoverapi.local/api/v2/system/endpoints" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer {token}"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const url = new URL(
    "http://r1discoverapi.local/api/v2/system/endpoints"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
```

{% endtab %}

{% tab title="C# - Http" %}

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.r1learning.com/api/v2/system/endpoints");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {token}");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

{% endtab %}
{% endtabs %}

## **Response**

### **Meta:**

Each List endpoint will contain a meta element which will describe the returned package. In this endpoint, the meta will provide the following information:

* **total\_items** (Integer): The number of parent programs returned
* **total pages** (integer): The number of pages returned in the call to the endpoint. (Total Items / per\_page limit)
* current\_page (integer): Indicates the current page number of the results&#x20;
* per\_page (integer): Indicates the number of results (topics) that will be listed on a single page. The default is 50, the limit is 100.

### **Data Dictionary:**

The response for the "API Endpoints" endpoint contains detailed information about each API available in the system. Below is a breakdown of each field in the response data:

* **data (Array):** Collection of data describing the available APIs.
  * **name (String):** The name of the API.
  * **url (Object):** Collection of data describing how the API is called.
    * **host (String):** The primary API site.
    * **path (String):** The path of the named API.
    * **raw (String):** The full URL of the API.
  * **variable (Array):** Collection of data describing the API parameters.
    * **id (String):** The string ID of the parameter.
    * **key (String):** The string key of the parameter.
    * **value (String):** The sample value set up in the API documentation.
    * **description (String):** The description of the parameter.
  * **method (Object):** Collection of data describing the header of the API.
    * **key (String):** The name of the header key.
    * **value (String):** The description of the header value.

### Response Examples

{% tabs %}
{% tab title="200: OK" %}

```json
{
    "error": 0,
    "message": "",
    "data": [
        {
            "name": "List Companies",
            "request": {
                "url": {
                    "host": "http://r1discoverapi.local",
                    "path": "api/v2/companies",
                    "query": [
                        {
                            "key": "page",
                            "value": "1",
                            "description": "The current page number, defaults to 1.",
                            "disabled": false
                        },
                        {
                            "key": "limit",
                            "value": "50",
                            "description": "Number of records to return default 50, max 100.",
                            "disabled": false
                        }
                    ],
                    "raw": "http://r1discoverapi.local/api/v2/companies?page=1&limit=50"
                },
                "method": "GET",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json"
                    },
                    {
                        "key": "Accept",
                        "value": "application/json"
                    },
                    {
                        "key": "Authorization",
                        "value": "Bearer {token}"
                    }
                ],
                "body": null,
                "description": ""
            }
        }
    ]
} 
```

{% endtab %}

{% tab title="401: Unauthorized" %}

```json
{
    "error": 1,
    "message": "Unauthenticated",
    "details": "Authentication is required to access this resource."
}
```

{% endtab %}

{% tab title="403: Unauthorized" %}

```json
{
    "error": 1,
    "message": "Unauthorized",
    "details": "You do not have the necessary permissions to perform this action."
}
```

{% endtab %}
{% endtabs %}

## Postman Link

{% embed url="<https://www.postman.com/fbomher/r1-discover-api/request/0jzhd33/list-api-endpoints>" %}
Link to the endpoint in Postman
{% endembed %}

## Notes

* **Authorization Required:** Ensure the provided Bearer token is valid and has sufficient privileges to access the endpoint.


---

# 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://docs.discover.r1learning.com/global-endpoints-system/list-api-endpoints.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.
