## List States

**get** `/states`

List all states, optionally filtered by query parameters.

### Query Parameters

- `agent_id: optional string`

  Agent ID

- `limit: optional number`

  Limit

- `order_by: optional string`

  Field to order by

- `order_direction: optional string`

  Order direction (asc or desc)

- `page_number: optional number`

  Page number

- `task_id: optional string`

  Task ID

### Returns

- `id: string`

  The task state's unique id

- `agent_id: string`

- `created_at: string`

  The timestamp when the state was created

- `state: map[unknown]`

- `task_id: string`

- `updated_at: optional string`

  The timestamp when the state was last updated

### Example

```http
curl http://localhost:5003/states \
    -H "Authorization: Bearer $AGENTEX_SDK_API_KEY"
```

#### Response

```json
[
  {
    "id": "id",
    "agent_id": "agent_id",
    "created_at": "2019-12-27T18:11:19.117Z",
    "state": {
      "foo": "bar"
    },
    "task_id": "task_id",
    "updated_at": "2019-12-27T18:11:19.117Z"
  }
]
```
