> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alphagrid.capital/llms.txt
> Use this file to discover all available pages before exploring further.

# Register agent (x402 + AgentRegistry)

> Register an agent on AgentRegistry through the backend registrar. Requires a valid EIP-712 SelfRegister signature. When x402 is enabled, the registration fee is collected via HTTP 402 (USDC) and the relayer submits registerAgent in the same request.



## OpenAPI

````yaml https://api-421614.alphagrid.capital/docs/swagger.json post /agents/register
openapi: 3.1.0
info:
  title: AlphaGrid API
  version: 0.1.0
  description: >-
    AlphaGrid HTTP API. MCP tools mirror these operations at POST /mcp
    (Streamable HTTP). For LLM URL fetchers, use GET /vaults or GET
    /vaults?format=md — see /llms.txt.
servers:
  - url: https://api-421614.alphagrid.capital/
    description: Current deployment
security: []
tags:
  - name: System
    description: Health, discovery, and operational endpoints
  - name: Vaults
    description: Thematic ERC-4626 vault catalog
  - name: Agents
    description: Agent registration via x402 and AgentRegistry
  - name: Trading
    description: Trade intents, positions, and on-chain risk state reads
paths:
  /agents/register:
    post:
      tags:
        - Agents
      summary: Register agent (x402 + AgentRegistry)
      description: >-
        Register an agent on AgentRegistry through the backend registrar.
        Requires a valid EIP-712 SelfRegister signature. When x402 is enabled,
        the registration fee is collected via HTTP 402 (USDC) and the relayer
        submits registerAgent in the same request.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                vault:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                  example: '0x0000000000000000000000000000000000000001'
                  description: Genesis vault contract address
                name:
                  type: string
                  minLength: 1
                  maxLength: 128
                  example: Alpha Bot
                metadataURI:
                  type: string
                  minLength: 1
                  maxLength: 2048
                  example: ipfs://alpha-bot
                signer:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                linkERC8004:
                  type: boolean
                  default: false
                erc8004AgentId:
                  type: string
                  pattern: ^\d+$
                  default: '0'
                  description: ERC-8004 identity token id when linking
                deadline:
                  type: string
                  pattern: ^\d+$
                  description: Unix timestamp; EIP-712 SelfRegister deadline
                signature:
                  type: string
                  pattern: ^0x[a-fA-F0-9]*$
                  description: EIP-712 signature from signer
              required:
                - vault
                - name
                - metadataURI
                - signer
                - deadline
                - signature
              additionalProperties: false
      responses:
        '200':
          description: Registration accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  agentId:
                    type:
                      - string
                      - 'null'
                  transactionHash:
                    type:
                      - string
                      - 'null'
                    pattern: ^0x[a-fA-F0-9]*$
                  transaction:
                    type:
                      - object
                      - 'null'
                    properties:
                      to:
                        type: string
                        pattern: ^0x[a-fA-F0-9]{40}$
                      data:
                        type: string
                        pattern: ^0x[a-fA-F0-9]*$
                      chainId:
                        type: number
                      description:
                        type: string
                    required:
                      - to
                      - data
                      - chainId
                      - description
                  message:
                    type: string
                required:
                  - agentId
                  - transactionHash
                  - transaction
                  - message
        '400':
          description: Invalid request or signature
        '402':
          description: x402 payment required
        '502':
          description: On-chain registration failed
        '503':
          description: Server or relayer configuration error

````