---
title: "Initialize agent authentication"
method: POST
path: "/agent/v2/auth/init"
tags: ["Agent"]
---

# Initialize agent authentication

`POST /agent/v2/auth/init`

## Request

- Base URL: `https://public-api-v2.bags.fm/api/v1`
- URL: `https://public-api-v2.bags.fm/api/v1/agent/v2/auth/init`
- Auth: none required
- TypeScript: <https://skmtc.dev/bags/apis/bags-public-api-v2/docs/agent/v2/auth/init/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate a signable challenge message and nonce for wallet-signature based agent authentication.

## Request body

- AgentAuthInitRequest
  - `address` string, required: Solana wallet public key (base58) that will sign the authentication challenge

## Response `200`

Successfully generated wallet challenge

- object
  - `success` boolean, required
  - `response` object
    - `message` string, required: Base58-encoded challenge message. Decode to raw bytes before signing with Ed25519.
    - `nonce` string, required: Single-use authentication nonce tied to the challenge message

## Other responses

- `400`: Bad request - Invalid wallet address or request payload
- `429`: Too many requests - Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/bags/apis/bags-public-api-v2.md) - [All operations](https://skmtc.dev/bags/apis/bags-public-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/bags/apis/bags-public-api-v2/revisions/4a14b82cd39d?raw)
