# Account

HTTP requests and responses for account.

## Get your account

`GET /api/v1/me`

Read your account ID and display name.

Authentication: Signed-in browser session.

### Example request

```js
const response = await fetch("/api/v1/me", {
  credentials: "include",
});
```

### Example response

```json
{
  "id": "35106440-4840-4d89-aa0d-c6ec6f12b313",
  "name": "Sam"
}
```

### Responses

- `200` **OK.** The request succeeded.
- `400` **Invalid.** The request doesn’t match the expected input.
- `401` **Unauthorized.** Sign in or supply a valid credential for this route.
- `403` **Forbidden.** The credential lacks permission, or the request isn’t allowed.
- `404` **Not found.** The resource doesn’t exist or isn’t available to you.
- `409` **Conflict.** The requested change conflicts with the current state or an account limit.
- `413` **Too large.** The request body exceeds the size limit.
- `429` **Rate limited.** Wait before sending more requests.
- `503` **Unavailable.** Poll Express couldn’t complete the request right now.

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "example": {
      "id": "35106440-4840-4d89-aa0d-c6ec6f12b313",
      "name": "Sam"
    }
  }
}
```

[Shared error details](https://poll.express/docs/api/index.md#errors)

## Exchange an agent setup token

`POST /api/v1/agent-setup/exchange`

Send the one-time setup token as a bearer credential. A successful exchange consumes it and shows the new MCP key once.

Authentication: One-time setup token.

### Request schema

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "agentName": {
          "type": "string"
        }
      },
      "required": [
        "agentName"
      ],
      "additionalProperties": false
    },
    "example": {
      "agentName": "Workshop assistant"
    }
  }
}
```

### Example request

```sh
curl -sS -X POST "https://poll.express/api/v1/agent-setup/exchange" \
  -H "Authorization: Bearer $POLL_SETUP_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"agentName":"Workshop assistant"}'
```

### Responses

- `201` **Created.** The request created a resource.
- `400` **Invalid.** The request doesn’t match the expected input.
- `401` **Unauthorized.** Sign in or supply a valid credential for this route.
- `403` **Forbidden.** The credential lacks permission, or the request isn’t allowed.
- `404` **Not found.** The resource doesn’t exist or isn’t available to you.
- `409` **Conflict.** The requested change conflicts with the current state or an account limit.
- `413` **Too large.** The request body exceeds the size limit.
- `429` **Rate limited.** Wait before sending more requests.
- `503` **Unavailable.** Poll Express couldn’t complete the request right now.

```json
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "key": {
          "type": "string"
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "poll.read",
              "poll.write",
              "poll.live"
            ]
          },
          "uniqueItems": true
        },
        "expiresAt": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "key",
        "scopes",
        "expiresAt"
      ],
      "additionalProperties": false
    }
  }
}
```

[Shared error details](https://poll.express/docs/api/index.md#errors)
