{
  "openapi": "3.1.0",
  "info": {
    "title": "Agentic Market API",
    "version": "1.0.0",
    "description": "Browse and call x402-enabled services — no API keys, no accounts, pay per request. Every service listed is callable onchain via the x402 payment protocol.",
    "contact": {
      "name": "Coinbase x402",
      "url": "https://docs.cdp.coinbase.com/x402/welcome"
    }
  },
  "servers": [
    {
      "url": "https://api.agentic.market",
      "description": "Production"
    }
  ],
  "paths": {
    "/v1/services": {
      "get": {
        "operationId": "listServices",
        "summary": "List all x402 services",
        "description": "Returns a paginated list of x402-enabled services with their endpoints, pricing, networks, and quality metrics.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 24
            },
            "description": "Maximum number of services to return"
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Number of services to skip for pagination"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of services",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServicesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/search/services": {
      "get": {
        "operationId": "searchServices",
        "summary": "Search services by keyword",
        "description": "Search x402-enabled services by name, description, or category.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 24
            },
            "description": "Maximum number of results"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching services",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServicesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/services/{id}": {
      "get": {
        "operationId": "getServiceById",
        "summary": "Get a service by ID",
        "description": "Returns full details of a single x402-enabled service.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Service identifier"
          }
        ],
        "responses": {
          "200": {
            "description": "Service details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "$ref": "#/components/schemas/Service"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Service not found"
          }
        }
      }
    },
    "/v1/ecosystem/overview": {
      "get": {
        "operationId": "getEcosystemOverview",
        "summary": "Ecosystem overview statistics",
        "description": "Returns aggregate ecosystem stats including transaction count, total amount, unique buyers, and unique sellers.",
        "parameters": [
          {
            "name": "timeframe",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Timeframe in days"
          }
        ],
        "responses": {
          "200": {
            "description": "Ecosystem overview"
          }
        }
      }
    },
    "/v1/ecosystem/transactions": {
      "get": {
        "operationId": "getRecentTransactions",
        "summary": "Recent transactions",
        "description": "Returns a list of recent x402 transactions across the ecosystem.",
        "responses": {
          "200": {
            "description": "Transaction list"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ServicesResponse": {
        "type": "object",
        "properties": {
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Service"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        },
        "required": [
          "services",
          "total",
          "limit",
          "offset"
        ]
      },
      "Service": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "providerUrl": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "networks": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enriched": {
            "type": "boolean"
          },
          "quality": {
            "$ref": "#/components/schemas/ServiceQuality"
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Endpoint"
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "endpoints"
        ]
      },
      "ServiceQuality": {
        "type": "object",
        "properties": {
          "score": {
            "type": "number"
          },
          "totalCalls": {
            "type": "integer"
          },
          "uniquePayers": {
            "type": "integer"
          },
          "lastCalledAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Endpoint": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "DELETE",
              "PATCH"
            ]
          },
          "pricing": {
            "$ref": "#/components/schemas/Pricing"
          },
          "quality": {
            "$ref": "#/components/schemas/EndpointQuality"
          }
        },
        "required": [
          "url",
          "method",
          "pricing"
        ]
      },
      "Pricing": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "network": {
            "type": "string"
          }
        },
        "required": [
          "amount",
          "currency"
        ]
      },
      "EndpointQuality": {
        "type": "object",
        "description": "Per-endpoint usage metrics for the trailing 30 days. Omitted entirely when an endpoint has no usage in that window. int64 values are protojson-encoded as strings.",
        "properties": {
          "l30DaysTotalCalls": {
            "type": "string",
            "description": "Total successful calls in the last 30 days (int64 as JSON string)."
          },
          "l30DaysUniquePayers": {
            "type": "string",
            "description": "Distinct paying wallets in the last 30 days (int64 as JSON string)."
          }
        }
      }
    }
  }
}
