{
  "openapi": "3.1.0",
  "info": {
    "title": "Elite Aesthetics Guide Public API",
    "version": "1.0.0",
    "description": "Programmatic access to independently-evaluated aesthetic providers across the United States, including credential verification status, recognition history, and business contact details. Free anonymous access for reasonable volumes; free API keys unlock higher limits.",
    "contact": {
      "name": "Elite Aesthetics Guide",
      "url": "https://eliteaestheticsguide.com/developers"
    },
    "termsOfService": "https://eliteaestheticsguide.com/terms"
  },
  "servers": [
    {
      "url": "https://eliteaestheticsguide.com/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {},
    {
      "ApiKeyHeader": []
    },
    {
      "ApiKeyBearer": []
    }
  ],
  "paths": {
    "/providers": {
      "get": {
        "summary": "List providers",
        "description": "Returns a paginated list of elite-listed aesthetic providers. Filter by category, region, city, or verification status.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "injector",
                "plastic_surgeon",
                "esthetician",
                "laser_specialist"
              ]
            }
          },
          {
            "name": "region",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Full US state name (e.g., Texas)."
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "verified",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "When true, only providers currently holding the EAG Verified badge."
          },
          {
            "name": "eliteOnly",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderList"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/providers/{id}": {
      "get": {
        "summary": "Get a single provider",
        "description": "Returns a single provider record. The `id` path parameter accepts the provider's stable identifier (UUID), their public URL slug, or their internal document id.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "provider": {
                      "$ref": "#/components/schemas/Provider"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Provider not found"
          }
        }
      }
    },
    "/providers/{id}/credentials": {
      "get": {
        "summary": "Get a provider's verified credentials",
        "description": "Returns only the verification sub-document for a provider — license, education, certifications, advanced training — with dated + source-linked evidence. Useful for AI agents that only care about the proof surface.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CredentialsOnly"
                }
              }
            }
          },
          "404": {
            "description": "Provider not found"
          }
        }
      }
    },
    "/providers/{id}/tldr": {
      "get": {
        "summary": "Get a provider's TLDR payload",
        "description": "Returns the public TLDR data for providers with an active enhanced or standalone TLDR page — practice tagline, services, before/after images, contact info.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "404": {
            "description": "Provider not found or does not have a public TLDR page"
          }
        }
      }
    },
    "/search": {
      "get": {
        "summary": "Search providers",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "ApiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "EAG API key"
      }
    },
    "schemas": {
      "ProviderList": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Provider"
            }
          }
        }
      },
      "Provider": {
        "type": "object",
        "required": [
          "identifier",
          "slug",
          "fullName",
          "category"
        ],
        "properties": {
          "identifier": {
            "type": "string",
            "description": "UUID v4 — stable, preferred external reference."
          },
          "slug": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "credentials": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "injector",
              "plastic_surgeon",
              "esthetician",
              "laser_specialist"
            ]
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "businessName": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "websiteUrl": {
            "type": "string"
          },
          "headshotUrl": {
            "type": "string"
          },
          "bio": {
            "type": "string"
          },
          "servicesOffered": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "eliteListed": {
            "type": "boolean"
          },
          "subcategory": {
            "type": "string",
            "nullable": true
          },
          "nationalRank": {
            "type": "integer",
            "nullable": true
          },
          "hallOfExcellence": {
            "type": "boolean"
          },
          "recognitionHistory": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "year": {
                  "type": "integer"
                },
                "designation": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                }
              }
            }
          },
          "verification": {
            "$ref": "#/components/schemas/Verification"
          },
          "urls": {
            "type": "object",
            "properties": {
              "profile": {
                "type": "string"
              },
              "card": {
                "type": "string"
              }
            }
          }
        }
      },
      "CredentialsOnly": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "verification": {
            "$ref": "#/components/schemas/Verification"
          }
        }
      },
      "Verification": {
        "type": "object",
        "nullable": true,
        "properties": {
          "eagVerified": {
            "type": "boolean"
          },
          "eagVerifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "license": {
            "type": "object",
            "nullable": true,
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "verified",
                  "pending",
                  "needs_action"
                ]
              },
              "licenseType": {
                "type": "string"
              },
              "licenseNumber": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "verifiedAgainst": {
                "type": "string",
                "nullable": true,
                "description": "URL of the registry we cross-checked against."
              },
              "verifiedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "evidenceUrl": {
                "type": "string",
                "nullable": true,
                "description": "Public, watermarked copy of the uploaded document."
              }
            }
          },
          "education": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CredentialEntry"
            }
          },
          "certifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CredentialEntry"
            }
          },
          "advancedTraining": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CredentialEntry"
            }
          }
        }
      },
      "CredentialEntry": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "pending",
              "needs_action"
            ]
          },
          "name": {
            "type": "string"
          },
          "issuingOrganization": {
            "type": "string"
          },
          "dateIssued": {
            "type": "string",
            "nullable": true
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "evidenceUrl": {
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  }
}