{
  "openapi": "3.1.0",
  "info": {
    "title": "BrandTerritory Attorney Directory API",
    "version": "1.0.1",
    "summary": "Personal injury law firms near a US location, for AI agents.",
    "description": "Read-only directory of personal injury law offices in measured US metros. Facts only, ordered by distance, no paid ordering. Results are ordered by distance from the location given. BrandTerritory is a directory and a measurement service, not a lawyer referral service, and this is not a recommendation or an endorsement of any firm. Map visibility measures how often an office shows up in Google Maps results across its metro. It does not measure quality or case results. Some listed firms subscribe to BrandTerritory. Subscribing never changes the order of results.",
    "contact": {
      "name": "BrandTerritory",
      "email": "profile@brandterritory.ai",
      "url": "https://brandterritory.ai"
    },
    "termsOfService": "https://api.brandterritory.ai/#terms"
  },
  "servers": [
    {
      "url": "https://api.brandterritory.ai"
    }
  ],
  "paths": {
    "/v1/attorneys": {
      "get": {
        "operationId": "findInjuryAttorneys",
        "summary": "Find personal injury attorneys near a location",
        "description": "Location is required: pass `location` (ZIP, 'City, ST', or 'lat,lng'), or `zip`, or `lat` and `lng`. It must be the location of the person who needs the attorney. Returns covered=false with an empty list when the area has not been measured.",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "5 digit ZIP code, 'City, ST', or 'lat,lng'.",
            "example": "85201"
          },
          {
            "name": "zip",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{5}$"
            }
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "lng",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "radius_miles",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 50,
              "default": 15
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 10
            }
          },
          {
            "name": "practice_area",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "personal_injury"
            },
            "description": "Only personal injury is supported."
          },
          {
            "name": "src",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Optional name of the calling agent, for attribution (for example 'muse')."
          }
        ],
        "responses": {
          "200": {
            "description": "Firms ordered by distance, or covered=false.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query_id": {
                      "type": "string"
                    },
                    "covered": {
                      "type": "boolean"
                    },
                    "location": {
                      "type": "object"
                    },
                    "radius_miles_used": {
                      "type": "number"
                    },
                    "firms_within_radius": {
                      "type": "integer"
                    },
                    "order": {
                      "type": "string"
                    },
                    "disclosure": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "listing_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "zip": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "distance_miles": {
                            "type": "number"
                          },
                          "phone": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "website": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Attributed link. Redirects to the firm's own website."
                          },
                          "website_domain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "primary_category": {
                            "type": "string"
                          },
                          "google_listing_claimed": {
                            "type": "boolean"
                          },
                          "hours": {
                            "type": [
                              "object",
                              "null"
                            ]
                          },
                          "map_visibility": {
                            "type": "object",
                            "properties": {
                              "metro": {
                                "type": "string"
                              },
                              "week_of": {
                                "type": "string"
                              },
                              "top3_share_pct": {
                                "type": "number"
                              },
                              "appears_share_pct": {
                                "type": "number"
                              },
                              "grid_samples": {
                                "type": "integer"
                              },
                              "what_this_is": {
                                "type": "string"
                              }
                            }
                          },
                          "brand_index": {
                            "type": "object"
                          },
                          "profile_type": {
                            "type": "string",
                            "enum": [
                              "standard",
                              "enhanced"
                            ]
                          },
                          "sponsored": {
                            "type": "boolean"
                          },
                          "offices_within_radius": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Location missing or not understood, or unsupported practice area."
          },
          "429": {
            "description": "Rate limited."
          }
        }
      }
    },
    "/v1/firms/{listing_id}": {
      "get": {
        "operationId": "getFirm",
        "summary": "One office plus the firm's other offices",
        "parameters": [
          {
            "name": "listing_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Office record."
          },
          "404": {
            "description": "Not found."
          }
        }
      }
    },
    "/v1/coverage": {
      "get": {
        "operationId": "getCoverage",
        "summary": "Measured metros with counts",
        "responses": {
          "200": {
            "description": "Coverage list."
          }
        }
      }
    }
  }
}