> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shovels.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Jurisdictions

> Searches for jurisdictions based on the provided search term.



## OpenAPI

````yaml https://api.shovels.ai/spec/v2/openapi.production.yaml get /jurisdictions/search
openapi: 3.1.0
info:
  title: The Shovels API v2
  description: >

    The Shovels REST API makes it easy for technology developers in the
    property, climate, and

    construction industries to access detailed information about building
    permits, contractors and

    construction activity. Our API is designed to be intuitive and fast. We look
    forward to seeing what

    you build with it:

    [let us
    know](https://docs.google.com/forms/d/e/1FAIpQLSfs5Z6NZyPdnRpL96bMduH95OhfFZgLz9Hkc0-Y7pukUxSLxQ/viewform)

    and we'll check it out!


    ## Key Features

    The API offers access to two primary objects: **Permits** and
    **Contractors**.

    - **Permits**: Official documents issued by city or county authorities
    required before commencing

    construction or alterations to a building.

    - **Contractors**: Skilled professionals in the building trades who
    undertake permitted

    construction projects on various properties.


    And some additional resources:

    - **Lists**: Endpoints for predefined values like tags and property types
    for query parameters.

    - **Addresses**: Endpoint for searching and resolving valid US addresses.

    - **Meta**: Endpoints for metadata about the API and the data behind it.


    ## Getting started


    To begin using the API, please contact our sales team at

    [sales@shovels.ai](mailto:sales@shovels.ai) or grab a

    [free API key](https://app.shovels.ai/create-account/).


    > **Info**: The free API key has a limited number of calls.

    If you hit the limit and need more, please reach out to
    [sales@shovels.ai](mailto:sales@shovels.ai)

    or call us at [1-800-511-7457](tel:+18005117457).


    ### Authentication

    Our API uses a straightforward header-based authentication method:

    ```

    X-API-Key: YOUR_API_KEY_HERE

    ```


    Example Request:


    ```sh

    curl -X GET "https://api.shovels.ai/v2/meta/release" \
            -H "X-API-Key: YOUR_API_KEY_HERE"
    ```


    ## API Details


    ### Quick Overview


    A few quick details about our API:


    | Type                |
    Description                                                                |

    |---------------------|----------------------------------------------------------------------------|

    | SSL only            | We require that all requests are done over
    SSL.                            |

    | UTF-8 encoding      | We use UTF-8
    everywhere.                                                   |

    | Method              | GET for all read
    calls.                                                    |

    | Date format         | All dates in the API are strings in the following
    format: YYYY-MM-DD.      |


    ### Response Types


    The API supports the following response codes:


    | Code | Description |

    |------|-------------|

    | **200 OK** | Everything worked as expected. |

    | **400 Bad Request** | There was something wrong with your request.
    Double-check your input. |

    | **401 Unauthorized** | You need to log in to access this. Make sure your
    API key is correct. |

    | **402 Payment Required** | You will get this error if your reach your
    trial API call limit. |

    | **403 Forbidden** | You don't have permission to access this. |

    | **404 Not Found** | We couldn't find what you're looking for. Check the
    URL or resource ID. |

    | **422 Unprocessable Entity** | There's an issue with the data you
    sent.         Check [Error Handling](#error-handling) if you get this error.
    |

    | **429 Too Many Requests** | You're sending requests too quickly. Slow down
    and try again later. |

    | **500 Internal Server Error** | Yikes, something went wrong on our end.
    Please let us know         at [support@shovels.ai](support@shovels.ai) |


    ### Data Format


    The API returns data in JSON format, either as pages or single objects.


    Paginated responses have the following structure:

    ```json

    {
      "items": [...],
      "size": 50,
      "next_cursor": "eyJkYXR..." | null
    }

    ```

    Where objects are returned as an array in the 'items' field.


    ### Cursor-Based Pagination


    The API uses cursor-based pagination for all paginated endpoints. This
    method uses an opaque

    cursor token to maintain your position in the result set, offering better
    performance,

    consistency, and stability, especially for large datasets.


    ```json

    {
      "items": [...],
      "size": 50,
      "next_cursor": "eyJkYXR.lIjoiMjA.yMy0"
    }

    ```


    To use cursor-based pagination:

    - For the first page: Simply make a request without any pagination
    parameters (or optionally
      specify `size` to control page size)
    - For subsequent pages: Include the `next_cursor` value from the previous
    response using the
      `cursor` parameter

    Example:

    ```

    GET /v2/permits/search?size=10

    GET /v2/permits/search?size=10&cursor=eyJkYXR.lIjoiMjA.yMy0

    ```


    When there are no more results, the `next_cursor` value will be `null`.


    ### Versioning


    The current version of the API is v2, which is reflected in the endpoints
    URL structure:

    `/v2/`. We plan to evolve our API by releasing new versions to ensure
    backward compatibility while

    maintaining a steady pace of continuous improvements.


    ### Error Handling


    Proper error messages and HTTP codes are provided to help you troubleshoot
    issues effectively. Refer

    to the [Response Types](#response-types) section for an overview of HTTP
    error codes and how to

    handle them. Below we describe how to interpret HTTP 422 code.


    #### 422 Unprocessable Entity

    A 422 Unprocessable Entity response occurs when the server understands the
    request but cannot

    process it due to invalid data. This helps you identify issues with your
    input.


    The response includes:


    - **loc**: The location of the error. The first value indicates the location
    and the second
      specifies the problematic field. Common values for the first value include:
        - **body**: The error is in the request body.
        - **query**: The error is in the query parameters.
        - **path**: The error is in the URL path.
        - **header**: The error is in the request headers.
    - **msg**: A message describing the error.

    - **type**: The type of error.


    This information helps you correct your request by pinpointing the exact
    issue. Here are some

    examples:


    **Request Body Error**

    ```json

    {
      "detail": [
        {
          "loc": ["body", "first_name"],
          "msg": "Field is required",
          "type": "value_error.missing"
        }
      ]
    }

    ```


    **Query Parameter Error**

    ```json

    {
      "detail": [
        {
          "loc": ["query", "page"],
          "msg": "Page must be a positive integer",
          "type": "type_error.integer"
        }
      ]
    }

    ```

    **Path Parameter Error**

    ```json

    {
      "detail": [
        {
          "loc": ["path", "id"],
          "msg": "Invalid ID format",
          "type": "value_error.id"
        }
      ]
    }

    ```

    **Header Error**

    ```json

    {
      "detail": [
        {
          "loc": ["header", "X-API-Key"],
          "msg": "API key is missing",
          "type": "value_error.missing"
        }
      ]
    }

    ```

    These examples show how different types of errors are reported, helping you
    to diagnose and fix

    issues in your API requests.


    ## Credit Limits


    API usage is tracked using credits. Each record returned counts as one
    credit.


    ### Response Headers


    Successful JSON responses that return records include credit headers:

    - `X-Credits-Request`: Credits consumed by this request

    - `X-Credits-Limit`: Your monthly credit limit (omitted if unlimited)

    - `X-Credits-Remaining`: Credits remaining in your limit (omitted if
    unlimited)


    ### Checking Usage


    Use `GET /v2/usage` to check your current credit usage:


    ```json

    {
      "credits_used": 847293,
      "credit_limit": 1000000
    }

    ```


    ### Exceeding Limits


    When you exceed your credit limit, the API returns HTTP 402:


    ```json

    {
      "detail": {
        "error": "Monthly credit limit exceeded.",
        "limit": 1000000
      }
    }

    ```


    Credits are calculated on a rolling 30-day window. Usage older than 30 days
    automatically falls off.
  version: 2.0.0
servers:
  - url: https://api.shovels.ai/v2
    description: Shovels API
security: []
tags:
  - name: Meta
    description: Endpoints that provide information about the API and the data.
  - name: Lists
    description: >-
      Predefined lists of values and categories, such as tags and property
      types, which can be utilized as query parameters in other API
      interactions.
  - name: Permits
    description: >-
      Official documents issued by cities or counties before construction or
      alteration of a building can begin.
  - name: Contractors
    description: >-
      Licensed professionals who do permitted work on residential and commercial
      buildings.
  - name: Addresses
    description: US address ID resolution, lookup and metrics endpoints.
  - name: Cities
    description: City ID resolution, lookup and metrics endpoints.
  - name: Counties
    description: County ID resolution, lookup and metrics endpoints.
  - name: Jurisdictions
    description: Jurisdiction ID resolution, lookup and metrics endpoints.
  - name: States
    description: State metrics endpoints.
  - name: Usage
    description: Credit usage tracking.
paths:
  /jurisdictions/search:
    get:
      tags:
        - Jurisdictions
      summary: Search Jurisdictions
      description: Searches for jurisdictions based on the provided search term.
      operationId: search_jurisdictions_jurisdictions_search_get
      parameters:
        - name: q
          in: query
          required: true
          schema:
            type: string
            title: Jurisdiction Name Search
            description: The name to search for in the jurisdiction fields.
          description: The name to search for in the jurisdiction fields.
      responses:
        '200':
          description: A list of jurisdictions that match the search text.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedGeoEntitiesResponse'
              example:
                items:
                  - geo_id: Q2l0eV8xMjM0NQ
                    name: Sanford, FL
                    state: FL
                  - geo_id: A2l0eV8xMjM0NQ
                    name: Abilene, TX
                    state: TX
                  - geo_id: B2l0eV8xMjM0NQ
                    name: Albany, CA
                    state: CA
                size: 3
        '404':
          description: The specified search query didn't match any jurisdictions
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    PaginatedGeoEntitiesResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/GeoEntitiesRead'
          type: array
          title: Items
          description: The list of items returned in the response following given criteria.
        size:
          type: integer
          title: Size
          description: The number of items returned in the response.
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: The cursor for retrieving the next page of results.
        total_count:
          anyOf:
            - $ref: '#/components/schemas/TotalCount'
            - type: 'null'
          description: >-
            Total result count (capped at 10,000). Present on first-page
            responses when include_count=true. null if the count query timed
            out.
      type: object
      required:
        - items
        - size
        - next_cursor
      title: PaginatedGeoEntitiesResponse
      description: Paginated response for geographical entities.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GeoEntitiesRead:
      properties:
        geo_id:
          type: string
          title: Geo Id
          description: Geolocation ID
        name:
          type: string
          title: Name
          description: Formatted entity name
        state:
          type: string
          title: State
          description: State abbreviation
      type: object
      required:
        - geo_id
        - name
        - state
      title: GeoEntitiesRead
      description: >-
        Base read model for geographic entities used in geo search API
        responses.
    TotalCount:
      properties:
        value:
          type: integer
          minimum: 0
          title: Value
          description: The count value, capped at 10,000.
        relation:
          type: string
          enum:
            - eq
            - gte
          title: Relation
          description: >-
            "eq" means value is the exact count. "gte" means the actual count is
            at least 10,000 (the cap).
      type: object
      required:
        - value
        - relation
      title: TotalCount
      description: >-
        Capped result count with Elasticsearch-style {value, relation} shape.


        When the exact count is known and within COUNT_CAP, relation is "eq".

        When the count exceeds COUNT_CAP, value is COUNT_CAP and relation is
        "gte",

        meaning "greater than or equal to COUNT_CAP".
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````