{
  "openapi": "3.1.0",
  "info": {
    "title": "HumanOS public service directory",
    "version": "1.0.0",
    "description": "Search public source records without a HumanOS account or API key. Display source credit and date with results and honor each source’s license. A reported location or listing does not establish HumanOS membership, an ownership claim, a service radius, current operating authority, or booking availability."
  },
  "servers": [
    {
      "url": "https://tryhumanos.com"
    }
  ],
  "paths": {
    "/api/services/directory": {
      "get": {
        "operationId": "searchPublicServiceDirectory",
        "summary": "Search public service references",
        "description": "Use HTTPS GET and send each supported parameter at most once. Browser callers can use ordinary fetch with credentials omitted. A 200 with an empty items array and no flag means no matching records. When needsLocality is true, ask for a city or state. When refine is true, ask for a company, service or more specific search. This endpoint provides paginated search. Example: GET https://tryhumanos.com/api/services/directory?state=CO&city=Denver&category=banking. To send a visitor to the same results, use https://tryhumanos.com/services?state=CO&city=Denver&category=banking.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Company name or search terms, including terms such as “plumber in Denver, CO”. A near-me phrase needs a city or state from the caller. Connecticut registrations support exact legal names and seven-digit entity IDs. Prefix a query with “CT registry” or use “CT entity ID 84” to search Connecticut registrations regardless of office location. Explicit city and state filters still apply to the office.",
            "schema": {
              "type": "string",
              "maxLength": 180
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Publisher-listed locality state, district or territory. Accepts a USPS code or full name. A source can report a mailing locality; see geography.listedLocality.kind.",
            "schema": {
              "type": "string",
              "maxLength": 35
            }
          },
          {
            "name": "jurisdiction",
            "in": "query",
            "required": false,
            "description": "Independent issuing U.S. state or territory: use its code or full name. Cross-state mailing addresses retain their issuer. Only qualified credential, registration and certification sources match. Pennsylvania filings require an exact name or filing ID and have no listed locality. Use CT registry before a Connecticut full-register entity ID or name.",
            "schema": {
              "type": "string",
              "maxLength": 35
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "Country of this U.S. directory. Accepted aliases include US, USA and United States. Other countries are outside this endpoint.",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "description": "Exact publisher-listed municipality. A registration with no listed locality does not match a city.",
            "schema": {
              "type": "string",
              "maxLength": 100,
              "examples": [
                "Denver"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Canonical service category slug. An unknown well-formed slug may return no matches.",
            "schema": {
              "type": "string",
              "maxLength": 80,
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
              "examples": [
                "plumbing"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "One-based page, up to 20 listings. Follow has_more while page is below 501. Keep filters unchanged between page requests.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 501,
              "default": 1
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "A page of results or a request for refinement.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SearchResults"
                    },
                    {
                      "$ref": "#/components/schemas/NeedsLocality"
                    },
                    {
                      "$ref": "#/components/schemas/Refine"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid search filter, repeated recognized parameter, or page outside its allowed range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Search temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CompanyContact": {
        "type": "object",
        "description": "Company-published contact details matched to the license number and issuer-listed holder. Each contact field has a corresponding evidence URL in sources.",
        "properties": {
          "website": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "contact_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "phone": {
            "type": "string",
            "pattern": "^\\+1[0-9]{10}$"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "checked_on": {
            "type": "string",
            "format": "date"
          },
          "sources": {
            "type": "object",
            "properties": {
              "website": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "contact_url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "phone": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "email": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            },
            "required": [
              "website"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "website",
          "checked_on",
          "sources"
        ],
        "additionalProperties": false
      },
      "OrganizationReference": {
        "type": "object",
        "properties": {
          "source_id": {
            "type": "string",
            "description": "HumanOS source identifier. Use together with source_record_id as the record key."
          },
          "source_record_id": {
            "type": "string",
            "description": "Original publisher identifier, scoped to source_id. Depending on the source it may identify a location or an organization."
          },
          "organization_name": {
            "type": "string",
            "description": "Published organization or location name."
          },
          "city": {
            "type": "string",
            "description": "Reported locality. An empty string for the New Hampshire OPLC company register or Connecticut Business Registry means the office locality is unlisted."
          },
          "state": {
            "type": "string",
            "description": "Reported USPS state, district or territory code. NH identifies the license jurisdiction for New Hampshire OPLC credentials. A Connecticut Business Registry result uses an empty string when the office is unlisted.",
            "pattern": "^(?:[A-Z]{2})?$",
            "maxLength": 2
          },
          "category": {
            "type": "string",
            "description": "Normalized directory category."
          },
          "website_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Public organization website, when supplied.",
            "format": "uri",
            "pattern": "^https://"
          },
          "company_contact": {
            "$ref": "#/components/schemas/CompanyContact"
          },
          "source_record_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Record-specific source evidence, when available. Use source_url otherwise.",
            "format": "uri",
            "pattern": "^https://"
          },
          "source_name": {
            "type": "string",
            "description": "Name of the original source."
          },
          "source_url": {
            "type": "string",
            "description": "Official public dataset or source page.",
            "format": "uri",
            "pattern": "^https://"
          },
          "source_version": {
            "type": "string",
            "description": "Published or curated source revision."
          },
          "source_date": {
            "type": "string",
            "description": "Source date as YYYY-MM-DD.",
            "format": "date"
          },
          "license_name": {
            "type": "string",
            "description": "Reuse terms provided for this source."
          },
          "license_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Source-specific license or reuse documentation, when available.",
            "format": "uri",
            "pattern": "^https://"
          },
          "attribution": {
            "type": "string",
            "description": "Display this credit with the source date and respect the supplied reuse terms."
          },
          "geography": {
            "type": "object",
            "description": "jurisdiction identifies the issuer state, country and type. listedLocality includes city, state, country and role (mailing, office or listed). verifiedOffice contains a separately corroborated office and source URLs when available. Unknown locations and service areas are null.",
            "required": [
              "jurisdiction",
              "listedLocality",
              "verifiedOffice",
              "serviceArea"
            ],
            "properties": {
              "jurisdiction": {
                "anyOf": [
                  {
                    "type": "object",
                    "required": [
                      "state",
                      "country",
                      "kind"
                    ],
                    "properties": {
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "country": {
                        "type": "string",
                        "const": "US"
                      },
                      "kind": {
                        "enum": [
                          "credential",
                          "registration",
                          "certification"
                        ]
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "listedLocality": {
                "anyOf": [
                  {
                    "type": "object",
                    "required": [
                      "kind",
                      "city",
                      "state",
                      "country"
                    ],
                    "properties": {
                      "kind": {
                        "enum": [
                          "mailing",
                          "office",
                          "listed"
                        ]
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "country": {
                        "type": "string",
                        "const": "US"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "verifiedOffice": {
                "anyOf": [
                  {
                    "type": "object",
                    "required": [
                      "city",
                      "state",
                      "country",
                      "sourceUrl",
                      "identitySourceUrl",
                      "observedOn"
                    ],
                    "properties": {
                      "city": {
                        "type": "string",
                        "minLength": 1
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "country": {
                        "type": "string",
                        "const": "US"
                      },
                      "sourceUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "identitySourceUrl": {
                        "type": "string",
                        "format": "uri"
                      },
                      "observedOn": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "serviceArea": {
                "type": "null",
                "description": "This source projection supplies no verified service-area extent."
              }
            }
          }
        },
        "required": [
          "source_id",
          "source_record_id",
          "organization_name",
          "city",
          "state",
          "category",
          "website_url",
          "source_record_url",
          "source_name",
          "source_url",
          "source_version",
          "source_date",
          "license_name",
          "license_url",
          "attribution"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "state": {
                  "const": ""
                }
              }
            },
            "then": {
              "properties": {
                "source_id": {
                  "const": "ct-sots-business-registry"
                },
                "city": {
                  "const": ""
                }
              }
            }
          }
        ],
        "additionalProperties": false
      },
      "SearchResults": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OrganizationReference"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "has_more"
        ],
        "additionalProperties": false
      },
      "NeedsLocality": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 0,
            "items": {
              "$ref": "#/components/schemas/OrganizationReference"
            }
          },
          "has_more": {
            "type": "boolean",
            "const": false
          },
          "needsLocality": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "items",
          "has_more",
          "needsLocality"
        ],
        "additionalProperties": false
      },
      "Refine": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 0,
            "items": {
              "$ref": "#/components/schemas/OrganizationReference"
            }
          },
          "has_more": {
            "type": "boolean",
            "const": false
          },
          "refine": {
            "type": "boolean",
            "const": true
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Published category slugs the visitor can choose to refine an ambiguous service search."
          }
        },
        "required": [
          "items",
          "has_more",
          "refine"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  },
  "externalDocs": {
    "description": "Search in HumanOS",
    "url": "https://tryhumanos.com/services"
  }
}
