# Records

A record is an object you search for, every collection has a set of records. Records contain attributes which can also be referred as fields.

#### Attributes

<table><thead><tr><th width="81.79998779296875">Field</th><th width="131.39996337890625">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>string</td><td>Every record in a collection has a unique identifier</td></tr><tr><td>data</td><td>json</td><td>Actual data objects you want to index in your searches</td></tr></tbody></table>

### Endpoints

#### Add records

Create a record method enables you to add records to a collection by sending one or more objects.

Each record contains a set of attributes and values and are represented in a JSON format.

<mark style="color:red;">`POST /collections/:collectionId/records`</mark>

example body

```
[
  {"id": "some-unique-id-1", "fname": "john", "lname":"doe"},
  {"id": "some-unique-id-2", "fname": "jane", "lname":"doe"}
]
```

response

```
{
  "status": 201
}
```

#### Delete a record

This method lets you delete one or more records from a collection using their ids.

> <mark style="color:red;">This is a destructive operation</mark>

<mark style="color:red;">`DELETE /collections/:collectionId/records/recordId`</mark>

response

```
{
  "status" : 200
}
```

#### Delete Multiple Records or Clear records

<mark style="color:red;">`DELETE /collections/:collectionId/records`</mark>

> <mark style="color:red;">This is a destructive operation</mark>

The end point allows you to delete multiple records at once. It is required to pass an array with ids to be deleted.

If passed a flag <mark style="color:red;">`?clear=true`</mark>, the end point will clear all records in the collection.<br>

**Sample Request Data**

```
['object-id-1','object-id-2','object-id-3']
```

response

```
{
  "status" : 200
}
```


---

# 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://greenapplesolutions.gitbook.io/greenapplesolutions-docs/records.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.
