{
  "openapi": "3.1.0",
  "info": {
    "title": "NFT Data",
    "version": "1.0.0",
    "description": "OpenSea Agent Tool that provides structured NFT collection and market data for AI agents.",
    "x-guidance": "POST /api/get-collection-data with a JSON body containing a 'collection' field set to an OpenSea collection slug (e.g. 'basedpunks'). Requires USDC payment (0.002 USDC per request) via x402 v2 on Base mainnet (PAYMENT-SIGNATURE header) or Solana mainnet (PAYMENT-SIGNATURE header), or MPP evm/charge on Base mainnet (Authorization: Payment header). Returns structured collection metadata, floor price, volume, sales, and owner data sourced from the OpenSea API v2.",
    "contact": {
      "email": "hi@nftdata.app"
    }
  },
  "externalDocs": {
    "description": "NFT Data API Documentation",
    "url": "https://www.nftdata.app/docs"
  },
  "paths": {
    "/api/get-collection-data": {
      "post": {
        "operationId": "get_collection_data",
        "summary": "Get NFT collection data",
        "description": "Returns structured NFT collection and market data for a given OpenSea collection slug. Requires USDC payment (0.002 USDC per request) via x402 v2 on Base mainnet or Solana mainnet, or MPP evm/charge on Base mainnet.",
        "tags": ["NFT Data"],
        "x-payment-info": {
          "protocols": [
            { "x402": { "networks": ["eip155:8453", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"], "scheme": "exact" } },
            { "mpp": { "method": "evm", "intent": "charge", "networks": ["eip155:8453"] } }
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "collection": {
                    "type": "string",
                    "description": "OpenSea collection slug (e.g. 'azuki'). The slug is the unique identifier visible in the collection's OpenSea URL.",
                    "minLength": 1,
                    "pattern": "^[a-z0-9][a-z0-9_-]*$"
                  }
                },
                "required": ["collection"]
              },
              "example": {
                "collection": "azuki"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with structured NFT collection data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Collection display name."
                    },
                    "slug": {
                      "type": "string",
                      "description": "Collection slug."
                    },
                    "contracts": {
                      "type": "array",
                      "description": "NFT contract addresses and their chains.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "address": { "type": "string" },
                          "chain": { "type": "string" }
                        }
                      }
                    },
                    "floor_price": {
                      "type": "number",
                      "description": "Current floor price of the collection."
                    },
                    "floor_price_currency": {
                      "type": "string",
                      "description": "Currency symbol for the floor price (e.g. ETH, USDC, HYPE)."
                    },
                    "one_day_sales": {
                      "type": "number",
                      "description": "Number of sales in the last 24 hours."
                    },
                    "one_day_volume": {
                      "type": "number",
                      "description": "Trading volume in the last 24 hours."
                    },
                    "one_day_volume_currency": {
                      "type": ["string", "null"],
                      "description": "Currency symbol for 24-hour volume."
                    },
                    "seven_day_sales": {
                      "type": ["number", "null"],
                      "description": "Number of sales in the last 7 days."
                    },
                    "seven_day_volume": {
                      "type": ["number", "null"],
                      "description": "Trading volume in the last 7 days."
                    },
                    "seven_day_volume_currency": {
                      "type": ["string", "null"],
                      "description": "Currency symbol for 7-day volume."
                    },
                    "thirty_day_sales": {
                      "type": ["number", "null"],
                      "description": "Number of sales in the last 30 days."
                    },
                    "thirty_day_volume": {
                      "type": ["number", "null"],
                      "description": "Trading volume in the last 30 days."
                    },
                    "thirty_day_volume_currency": {
                      "type": ["string", "null"],
                      "description": "Currency symbol for 30-day volume."
                    },
                    "total_sales": {
                      "type": "number",
                      "description": "Total lifetime sales count."
                    },
                    "total_volume": {
                      "type": "number",
                      "description": "Total lifetime trading volume."
                    },
                    "total_volume_currency": {
                      "type": ["string", "null"],
                      "description": "Currency symbol for total lifetime volume."
                    },
                    "num_owners": {
                      "type": "number",
                      "description": "Current number of unique owners."
                    },
                    "total_supply": {
                      "type": ["number", "null"],
                      "description": "Total number of NFTs in the collection."
                    },
                    "created_date": {
                      "type": ["string", "null"],
                      "description": "Collection creation date (ISO 8601)."
                    }
                  },
                  "required": [
                    "name", "slug", "contracts",
                    "floor_price", "floor_price_currency",
                    "one_day_sales", "one_day_volume",
                    "total_sales", "total_volume", "num_owners"
                  ]
                },
                "example": {
                  "name": "based punks",
                  "slug": "basedpunks",
                  "contracts": [
                    {
                      "address": "0xcb28749c24af4797808364d71d71539bc01e76d4",
                      "chain": "base"
                    }
                  ],
                  "floor_price": 0.02391776,
                  "floor_price_currency": "ETH",
                  "one_day_sales": 1,
                  "one_day_volume": 0.0185,
                  "one_day_volume_currency": "ETH",
                  "seven_day_sales": 16,
                  "seven_day_volume": 0.34213836,
                  "seven_day_volume_currency": "ETH",
                  "thirty_day_sales": 217,
                  "thirty_day_volume": 1.50135021,
                  "thirty_day_volume_currency": "ETH",
                  "total_sales": 18027,
                  "total_volume": 4728.074488347124,
                  "total_volume_currency": "ETH",
                  "num_owners": 2408,
                  "total_supply": 5000,
                  "created_date": "2024-04-05"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Missing or invalid collection slug.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. The response includes both PAYMENT-REQUIRED (x402 v2) and WWW-Authenticate: Payment (MPP evm/charge) challenge headers. Submit payment using either protocol."
          },
          "404": {
            "description": "Collection not found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Retry after the indicated delay.",
            "headers": {
              "Retry-After": {
                "schema": { "type": "string" },
                "description": "Seconds to wait before retrying."
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "get_openapi_spec",
        "summary": "OpenAPI specification",
        "description": "Returns this OpenAPI 3.1.0 specification. No payment required.",
        "tags": ["Meta"],
        "security": [],
        "responses": {
          "200": {
            "description": "OpenAPI 3.1.0 specification document.",
            "content": {
              "application/json": {
                "schema": { "type": "object" }
              }
            }
          }
        }
      }
    }
  }
}
