> ## 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.

# Get Contractors By Id

> Returns contractors by their IDs. Multiple `id` query parameters can be provided in the same API call



## OpenAPI

````yaml https://api.shovels.ai/spec/v2/openapi.production.yaml get /contractors
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:
  /contractors:
    get:
      tags:
        - Contractors
        - Contractors
      summary: Get Contractors By Id
      description: >-
        Returns contractors by their IDs. Multiple `id` query parameters can be
        provided in the same API call
      operationId: get_contractors_by_id_contractors_get
      parameters:
        - name: id
          in: query
          required: true
          schema:
            type: array
            items:
              type: string
            title: Contractor ID
            description: Filter by the contractor ID.
            maxItems: 50
          description: Filter by the contractor ID.
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Cursor for pagination
            title: Cursor
          description: Cursor for pagination
      responses:
        '200':
          description: A list of contractors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedContractorsResponse'
              example:
                example:
                  items:
                    - id: e79c3393ad
                      license: '961870'
                      name: CA SUNRISE CONSTRUCTION SOLUTION INC.
                      business_name: CA SUNRISE CONSTRUCTION SOLUTION INC.
                      business_type: Corporation
                      classification: CFC
                      license_issue_date: '2018-05-15'
                      license_exp_date: '2024-05-15'
                      license_act_date: '2018-05-15'
                      primary_phone: (425) 507-4300
                      primary_email: atobar.casunrise@gmail.com
                      phone: (425) 270-9678,(425) 281-6152
                      email: atobar.casunrise@gmail.com,david@calsunrise.com
                      dba: SUNRISE SOLAR
                      sic: '1731'
                      naics: '238210'
                      linkedin_url: https://linkedin.com/company/ca-sunrise-constr
                      revenue: $1M-$5M
                      employee_count: 10-49
                      primary_industry: Solar Installation
                      review_count: 42
                      rating: 4.8
                      status_tally:
                        final: 754
                        active: 81
                        in_review: 2
                        inactive: 313
                      tag_tally:
                        hvac: 27
                        solar: 39
                        roofing: 1
                        pool_and_hot_tub: 1
                        heat_pump: 267
                        electrical: 1110
                        new_construction: 20
                      permit_count: 1150
                      avg_job_value: 1500000
                      total_job_value: 172500000
                      avg_construction_duration: 45
                      avg_inspection_pass_rate: 85
                      address:
                        street_no: '2800'
                        street: COTTONWOOD DR
                        city: SAN BRUNO
                        zip_code: '94066'
                        state: CA
                        address_id: asd8a8b19
                        latlng:
                          - 37.37619
                          - -121.869064
                  size: 1
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    PaginatedContractorsResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ContractorsRead'
          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: PaginatedContractorsResponse
      description: Schema for paginated contractors details response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ContractorsRead:
      properties:
        id:
          type: string
          title: Id
          description: The contractor ID.
        license:
          anyOf:
            - type: string
            - type: 'null'
          title: License
          description: The contractor license number.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: The contractor name.
        business_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Name
          description: The contractor business name.
        business_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Business Type
          description: >-
            The type of business: JointVenture, Corporation, Partnership,
            Limited Liability, Sole Owner.
        classification:
          anyOf:
            - type: string
            - type: 'null'
          title: Classification
          description: The contractor's classification/certification.
        classification_derived:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Classification Derived
          description: Array of derived contractor classifications.
        license_issue_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: License Issue Date
          description: The license issue date.
        license_exp_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: License Exp Date
          description: The license expiration date.
        license_inact_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: License Inact Date
          description: Date when the contractor's license became inactive.
        license_act_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: License Act Date
          description: Date when the contractor's license became active.
        primary_phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Primary Phone
          description: The contractor's primary phone number.
        primary_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Primary Email
          description: The contractor's primary email.
        phone:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone
          description: The contractor's phone number(s).
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: The contractor's email(s).
        website:
          anyOf:
            - type: string
            - type: 'null'
          title: Website
          description: The contractor's website).
        dba:
          anyOf:
            - type: string
            - type: 'null'
          title: Dba
          description: Doing Business As name for the contractor.
        sic:
          anyOf:
            - type: string
            - type: 'null'
          title: Sic
          description: Standard Industrial Classification (SIC) code of the contractor.
        naics:
          anyOf:
            - type: string
            - type: 'null'
          title: Naics
          description: >-
            North American Industry Classification System (NAICS) code of the
            contractor.
        linkedin_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Linkedin Url
          description: LinkedIn URL of the contractor.
        revenue:
          anyOf:
            - type: string
            - type: 'null'
          title: Revenue
          description: Annual revenue of the contractor's business.
        employee_count:
          anyOf:
            - type: string
            - type: 'null'
          title: Employee Count
          description: Number of employees working for the contractor.
        primary_industry:
          anyOf:
            - type: string
            - type: 'null'
          title: Primary Industry
          description: Primary industry in which the contractor operates.
        review_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Review Count
          description: Number of reviews the contractor has received.
        rating:
          anyOf:
            - type: number
            - type: 'null'
          title: Rating
          description: Rating of the contractor based on reviews.
        status_tally:
          anyOf:
            - additionalProperties:
                type: integer
              type: object
            - type: 'null'
          title: Status Tally
          description: >-
            The summary of all status counts for contractors' work. Available
            statuses: active, final, unknown, inactive, in_review.
          default: {}
        tag_tally:
          anyOf:
            - additionalProperties:
                type: integer
              type: object
            - type: 'null'
          title: Tag Tally
          description: The summary of all tag counts for contractors' work.
          default: {}
        permit_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Permit Count
          description: The total number of permits.
        avg_job_value:
          anyOf:
            - type: integer
            - type: 'null'
          title: Avg Job Value
          description: >-
            The average job value of all permits in cents (integer value
            representing dollars × 100).
        total_job_value:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Job Value
          description: >-
            The total job value of all permits in cents (integer value
            representing dollars × 100).
        avg_construction_duration:
          anyOf:
            - type: integer
            - type: 'null'
          title: Avg Construction Duration
          description: The average construction duration in days.
        avg_inspection_pass_rate:
          anyOf:
            - type: integer
            - type: 'null'
          title: Avg Inspection Pass Rate
          description: The average inspection pass rate as a percentage (0-100).
        first_seen_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: First Seen Date
          description: Date when the contractor was first seen in the system.
        address:
          anyOf:
            - $ref: '#/components/schemas/AddressesEmbedded'
            - type: 'null'
          description: >-
            The contractor's address dictionary that contains street_no, street,
            city, jurisdiction, zip_code, zip_code_ext, state, and latlng
            fields.
      type: object
      required:
        - id
        - address
      title: ContractorsRead
      description: Schema for contractor response with embedded address.
    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
    AddressesEmbedded:
      properties:
        street_no:
          anyOf:
            - type: string
            - type: 'null'
          title: Street No
          description: The number of the street of the address.
        street:
          anyOf:
            - type: string
            - type: 'null'
          title: Street
          description: The name of the street of the address.
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: The city of the address.
        county:
          anyOf:
            - type: string
            - type: 'null'
          title: County
          description: The county of the address.
        zip_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip Code
          description: The ZIP code of the address.
        zip_code_ext:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip Code Ext
          description: The extension of the ZIP code of the address.
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: The state of the address.
        jurisdiction:
          anyOf:
            - type: string
            - type: 'null'
          title: Jurisdiction
          description: The jurisdiction the address belongs to.
        address_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Id
          description: The address identifier.
        latlng:
          anyOf:
            - items:
                anyOf:
                  - type: number
                  - type: 'null'
              type: array
            - type: 'null'
          title: Latlng
          description: The latitude and longitude of the address.
      type: object
      title: AddressesEmbedded
      description: >-
        Schema for embedded address object with location data to be used as a
        nested JSON object.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````