# Get Data

### Get a Single Value

```
GET /api/v1/data?userId={userId}&key={key}
```

#### Parameters

| Parameter | Type   | Required   | Description                 |
| --------- | ------ | ---------- | --------------------------- |
| `userId`  | string | <h3>✓</h3> | The player's Roblox user ID |
| `key`     | string | <h3>✓</h3> | The key to retrieve         |

#### Example Request

```lua
local data = Auxvyn.get(player.UserId, "coins")
```

#### Example Response

```json
{
  "success": true,
  "data": {
    "key": "coins",
    "value": 500,
    "updated_at": "2024-03-18T20:21:04.000Z"
  }
}
```

#### Returns

The value stored at that key, or `nil` if the key does not exist.

***

### Get All Values

```
GET /api/v1/data?userId={userId}
```

#### Parameters

| Parameter | Type   | Required   | Description                 |
| --------- | ------ | ---------- | --------------------------- |
| `userId`  | string | <h3>✓</h3> | The player's Roblox user ID |

#### Example Request

```lua
local data = Auxvyn.getAll(player.UserId)
```

#### Example Response

```json
{
  "success": true,
  "data": {
    "coins": 500,
    "level": 3,
    "inventory": ["sword", "shield"]
  }
}
```

#### Returns

A table of all key-value pairs stored for that player, or `nil` if the player has no data.

***

### Error Responses

| Code  | Reason                     |
| ----- | -------------------------- |
| `400` | Missing `userId` parameter |
| `401` | Missing or invalid API key |
| `404` | Player has no data stored  |

***

### Notes

* If a player has never had any data stored, `Auxvyn.get()` returns `nil`  (always use a default value)
* User IDs are stored as strings internally, you can pass either a number or string and Auxvyn handles the conversion
* Values can be numbers, strings, booleans, or tables

***

### What's Next


---

# 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://auxvyn.gitbook.io/auxvyn-docs/api-reference/get-data.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.
