> For the complete documentation index, see [llms.txt](https://backbench.gitbook.io/backbench-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://backbench.gitbook.io/backbench-docs/api-reference.md).

# API Reference

Use the pre-programmed API Reference material by Backbench when developing your applications.

## REST API

### Memory

Send a`POST`request to endpoint [https://memory.backbench.io](https://memory.backbench.io/).

The request body/payload has the following format:

```javascript
{
    "cmd": "",
    "auth": {
        "benchId": "",
        "userId": "",
        "accessKey": ""
    },
    "args": {
    },
    "json": true
}
```

**cmd, args**: are operation depedent. \
**auth:** Used as security for API, It has 3 mandatory properties - `benchId, userId, accessKey`. `accessKey` value can be accessed from environment variable `ACCESS_KEY`.

#### Setting Memory

```
"cmd" : "bb:mem:set" 
"args": {"key": "", "value": ""}
```

#### Getting Memory

```
"cmd" : "bb:mem:get"
"args": {"key": ""}
```

#### Deleting Memory

```javascript
"cmd" : "bb:mem:del"
"args": {"key": ""}
```

An example payload for setting up memory in backbench.

```javascript
{
    "cmd": "bb:mem:set",
        "auth": {
            "benchId": "aaaaa0",
            "userId": "mybench",
            "accessKey": "c72d2f3a91b80c1e7fb46f4332383795facd8e99df31b689513c2fa11a699adb"
        },
        "args": {
            "key": "jlo",
            "value": "one the floor"
        }
}
```

### Logs

Payload for logs goes like this;

```javascript
"cmd" : "bb:log"
"args": {"message": ""}
```
