# Collections

{% hint style="warning" %}
myJson API V1 is deprecated. Please consider moving to the new [V2 API](https://docs.myjson.online/)
{% endhint %}

## Get all records

## Return all records from the collection

<mark style="color:blue;">`GET`</mark> `https://api.myjson.online/v1/collections/:collectionId/records`

#### Path Parameters

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| collectionId<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                      | Type          | Description                      |
| ------------------------- | ------------- | -------------------------------- |
| x-collection-access-token | String        |                                  |
| x-record-metadata         | true \| false | default to true, return metadata |

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

```json
{
    records: [{ data, id }]
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
    error: "Bad Request",
    message: "Invalid request"
}
```

{% endtab %}
{% endtabs %}

```javascript
// Javascript example
var myHeaders = new Headers();
myHeaders.append("x-collection-access-token", "YOUR_COLLECTION_ACCESS_TOKEN");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.myjson.online/v1/collections/YOUR_COLLECTION_ID/records", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

```


---

# 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.myjson.online/v1/endpoints/collections.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.
