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

# Register Agent and Plan

> Creates both an agent and associated payment plan in a single request.



## OpenAPI

````yaml POST /protocol/agents/plans
openapi: 3.1.0
info:
  title: Nevermined API
  description: >-
    API for managing AI agents, payment plans, and x402 payments in the
    Nevermined ecosystem.


    ## Prerequisites


    You need a Nevermined API Key to authenticate. Get one at
    [nevermined.app](https://nevermined.app) under **Settings > API Keys**.


    See the [5-Minute Setup Guide](/docs/integrate/quickstart/5-minute-setup)
    for detailed instructions.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.sandbox.nevermined.app/api/v1
    description: Sandbox (Testing) - Base Sepolia
  - url: https://api.live.nevermined.app/api/v1
    description: Live (Production) - Base Mainnet
security:
  - bearerAuth: []
tags:
  - name: Protocol - Agents
    description: Endpoints for registering and managing AI agents
  - name: Protocol - Plans
    description: Endpoints for creating and managing payment plans
  - name: Protocol - Credits
    description: Endpoints for minting and redeeming credits
  - name: Protocol - Access
    description: Endpoints for access tokens and request validation
  - name: X402 - Permissions
    description: Endpoints for x402 delegated permissions
paths:
  /protocol/agents/plans:
    post:
      tags:
        - Protocol - Agents
      summary: Register Agent and Plan
      description: Creates both an agent and associated payment plan in a single request.
      operationId: registerAgentAndPlan
      requestBody:
        description: Agent and plan configuration
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterAgentAndPlanRequest'
            example:
              agentMetadata:
                name: Legal Assistant
                description: AI-powered legal analysis
                tags:
                  - legal
                  - ai
              agentApi:
                endpoints:
                  - POST: https://your-api.com/query
                agentDefinitionUrl: https://your-api.com/openapi.json
              planMetadata:
                name: Starter Plan
                description: 100 requests for $10
              priceConfig:
                priceType: FIXED_PRICE
                tokenAddress: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
                amounts:
                  - 10000000
                receivers:
                  - 0xYourWalletAddress
              creditsConfig:
                creditsType: FIXED
                amount: 100
                minAmount: 1
              accessLimit: credits
      responses:
        '200':
          description: Agent and plan created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentAndPlanCreatedResponse'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
components:
  schemas:
    RegisterAgentAndPlanRequest:
      type: object
      required:
        - agentMetadata
        - agentApi
        - planMetadata
        - priceConfig
        - creditsConfig
      properties:
        agentMetadata:
          type: object
          properties:
            name:
              type: string
            description:
              type: string
            tags:
              type: array
              items:
                type: string
        agentApi:
          type: object
          properties:
            endpoints:
              type: array
              items:
                type: object
            agentDefinitionUrl:
              type: string
        planMetadata:
          type: object
          properties:
            name:
              type: string
            description:
              type: string
        priceConfig:
          $ref: '#/components/schemas/PriceConfig'
        creditsConfig:
          $ref: '#/components/schemas/CreditsConfig'
        accessLimit:
          type: string
          enum:
            - credits
            - time
    AgentAndPlanCreatedResponse:
      type: object
      properties:
        success:
          type: boolean
        agentId:
          type: string
        planId:
          type: string
    PriceConfig:
      type: object
      properties:
        priceType:
          type: string
          enum:
            - FIXED_PRICE
            - FREE
        tokenAddress:
          type: string
          description: ERC20 token address (e.g., USDC)
        amounts:
          type: array
          items:
            type: integer
          description: Price amounts (6 decimals for USDC)
        receivers:
          type: array
          items:
            type: string
          description: Wallet addresses to receive payment
    CreditsConfig:
      type: object
      properties:
        creditsType:
          type: string
          enum:
            - FIXED
            - EXPIRABLE
        amount:
          type: integer
          description: Number of credits
        minAmount:
          type: integer
          description: Minimum credits per request
        durationOfThePlan:
          type: integer
          description: Duration in seconds (for EXPIRABLE)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your Nevermined API Key (starts with 'nvm:'). Get one at
        [nevermined.app](https://nevermined.app) under **Settings > API Keys**.

````