# Records your Ownbox keeps

Part of the [Ownbox SDK reference](https://www.ownbox.io/sdk/reference.md).

## m.keep

```python
m.keep(kind, key, fields, person=None)
```

Hand your Ownbox one record to keep.

Your Ownbox keeps the data, never the machine. Each kind of record is declared in machine.yaml under `records:`, beside `actions:`, and a record is a JSON object of at most 16 KB under a key of 1 to 100 characters. The same key again replaces it. `person` names who it is about, only on a kind declared `person: true`. A machine keeps at most 10,000 records and 20 MB in all; past either the call is refused, and nothing is cut short.

**Needs in machine.yaml:** its kind, declared under records in machine.yaml

**Returns:** `{"kept": True}`.

Example (inside a job):

```python
ava = m.person("email", "ava@example.com", name="Ava Reyes")
m.keep("quote", "q-1001", {"total": 450, "status": "sent"}, person=ava)
```

## m.kept

```python
m.kept(kind, key=None, *, limit=50, cursor=None)
```

Read your records back.

With a key, that record's fields, or None. Without one, a page of that kind's records, newest first: 50 unless `limit` says otherwise, and at most 200. Pass `next` back as `cursor` for the page after; it is "" at the end.

**Needs in machine.yaml:** its kind, declared under records in machine.yaml

**Returns:** The record's fields, or `{"records": [{"key", "fields", "person", "updated_at"}], "next"}`.

Example (inside a job):

```python
quote = m.kept("quote", "q-1001")
page = m.kept("quote", limit=20)
while page["next"]:
    page = m.kept("quote", limit=20, cursor=page["next"])
```

## m.drop

```python
m.drop(kind, key)
```

Let one record go.

It is gone from your Ownbox. Dropping a key it never kept is not an error.

**Needs in machine.yaml:** its kind, declared under records in machine.yaml

**Returns:** `{"dropped": True}`, or False when there was none.

Example (inside a job):

```python
m.drop("quote", "q-1001")
```

