> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tradeguardins.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tradeguardins.com/_mcp/server.

# Create a subcontractor

POST https://api.tradeguardins.com/v1/subcontractors
Content-Type: application/json

Creates a subcontractor and enrolls it in your organization.

Subcontractor records are shared across TradeGuard within an environment (sandbox subcontractors are separate from production ones).
To add one that is already on TradeGuard, find it with
[Look up subcontractors](https://docs.tradeguardins.com/api-reference/subcontractors/lookup-subcontractors) and send its
id as `existingSubcontractorId`: it is added to your organization, the
response has `matchedExisting: true`, and its stored company details
are **not** overwritten by this request (use
[Update a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/update-subcontractor)).

Without `existingSubcontractorId`, a new subcontractor is created. If
one with the same `contactEmail` (case-insensitive) or `contactPhone`
already exists, nothing is linked automatically and the call fails with
`409 subcontractor_match`: the message names that subcontractor (and its
city and state, when on file), and `details` holds its id (path
`existingSubcontractorId`) and the field that matched. Send the request
again with that `existingSubcontractorId` to add it, or with
`createNew: true` if it is a different company. If the match is already
enrolled with your organization the call fails with `409 conflict`
instead: `details` holds its id (path `subcontractorId`) and the field
that matched. The match never checks the contact another organization
set privately for a subcontractor.

**Shared vs. your own.** Company details (name, entity type, EIN, owner,
address, website, licenses, trade) are shared by every organization that
enrolls the subcontractor; any of them can edit those, and each edit is
recorded in the subcontractor's activity. Your contact person
(`contactName`, `contactEmail`, `contactPhone`), `externalId` and
`metadata` are your organization's own: when you join an existing
subcontractor your contact is the one you sent (its default contact fills
any field you left out), and no other organization sees or changes these
fields.

The given `complianceProfileId` — or, when omitted, your organization's
default profile (if one is set) — is attached right away, creating its
compliance records and starting an onboarding compliance run.

**Secretary of State and license checks.** If the profile includes one,
it runs automatically once the subcontractor has the information it
needs: a Secretary of State check needs `companyName` (or `firstName` +
`lastName`) and `businessAddress.state`; a license check needs
`tradeCategory` and `businessAddress.state` (plus the license's `state`
when you send `licenses`). `data.informationNeeded` lists what is still
missing; until it's added the requirement reads `pending` with
`statusReason` "Waiting on information: …". See the "Secretary of State
and License Checks" guide.

**Invite.** When TradeGuard collects documents for your organization,
adding the subcontractor also invites it: Jake from TradeGuard emails
your `contactEmail` for it with what's needed and a link to its portal,
in the next sending window, then follows up. `data.invite` says what
happened; the add never fails because of the invite. If your
organization collects documents itself, nothing is sent
(`invite.status: skipped`, `reason: customer_collects`). See
[Invite a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/invite-subcontractor).

`422` is returned for a malformed `ein`, more than one primary license,
or a duplicate (state, licenseNumber) pair. Its `details` names the
field: `ein`, `licenses`, or `licenses.{index}.licenseNumber`.

`contactEmail` is trimmed before it is checked, so a stray space
pasted with the address is not an error.

Requires scope `subcontractors:write`. Returns `404` if `organizationId`
is not one of the caller's organizations or the caller's organization has
not been provisioned.

Reference: https://docs.tradeguardins.com/api-reference/subcontractors/create-subcontractor

## Authentication

- `Authorization` header (bearer token, required) — Session JWT or API key (`ak_...`)

## Request

### Body (application/json)

This endpoint expects a CreateSubcontractorRequest.

- `CreateSubcontractorRequest`
  - Business: CreateBusinessSubcontractor
  - Individual (sole proprietor): CreateIndividualSubcontractor
  - Existing subcontractor: AddExistingSubcontractor

## Response

### 201

Subcontractor created, or an existing subcontractor added to your organization (`matchedExisting`)

- `data` (V1SubcontractorsPostResponsesContentApplicationJsonSchemaData, optional) — Shared company details plus your organization's own contact, `externalId` and `metadata` (never another organization's).
- `matchedExisting` (boolean, optional) — True when you added an existing subcontractor with `existingSubcontractorId` instead of creating a new one; its stored company details are not overwritten by this request.

## Errors

### 400 Bad Request Error

Request failed schema validation (`validation_failed`)

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

### 401 Unauthorized Error

Missing, malformed, expired or revoked credential (`unauthenticated`)

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

### 403 Forbidden Error

The credential lacks the scope or role for this action (`forbidden`)

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

### 404 Not Found Error

Resource not found, or not visible to the caller's organization (`not_found`)

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

### 409 Conflict Error

`subcontractor_match`: the email or phone matches a subcontractor already on TradeGuard; `details` has its id (path `existingSubcontractorId`) and the matched field. Resend with `existingSubcontractorId` or `createNew: true`. `conflict`: that subcontractor is already enrolled with your organization; `details` has its id (path `subcontractorId`) and the matched field.

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

### 422 Unprocessable Entity Error

Well-formed but rejected by a business rule (`unprocessable`)

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

### 429 Too Many Requests Error

Rate limit exceeded (`rate_limited`); retry after `Retry-After` seconds

- `error` (string, required) — Human-readable message. Wording may change; do not parse it.
- `code` (enum, required) — Stable, machine-readable error code. Status-level codes: `bad_request` (400), `unauthenticated` (401), `forbidden` (403), `not_found` (404), `method_not_allowed` (405, with an `Allow` header), `conflict` (409), `gone` (410), `payload_too_large` (413), `unprocessable` (422), `rate_limited` (429), `internal_error` (500), `bad_gateway` (502), `service_unavailable` (503). Specific codes: `validation_failed` and `invalid_identifier` (400); `reextraction_limit_reached` and `llm_budget_exhausted` (429, document re-extraction only); `sandbox_unavailable` (503, a sandbox key used where the sandbox is not provisioned); `assignment_exists` (409, a live assignment for this subcontractor and project already exists — its id is in `details`), `project_not_ready` (409, the project's setup is not Ready), `project_document` (409, a baseline-only action on a project certificate) and `subcontractor_match` (409, a new subcontractor's email or phone matches one already on TradeGuard — its id is in `details`); `portal_link_expired` and `portal_link_used` (410, sub portal links only).
  - Allowed values: `bad_request`, `unauthenticated`, `forbidden`, `not_found`, `method_not_allowed`, `conflict`, `gone`, `payload_too_large`, `unprocessable`, `rate_limited`, `internal_error`, `bad_gateway`, `service_unavailable`, `validation_failed`, `invalid_identifier`, `reextraction_limit_reached`, `llm_budget_exhausted`, `sandbox_unavailable`, `assignment_exists`, `project_not_ready`, `project_document`, `subcontractor_match`, `portal_link_expired`, `portal_link_used`
- `requestId` (string, optional) — Same value as the `x-request-id` response header.
- `details` (list of ErrorDetailsItems, optional) — Present when `code` is `validation_failed`.

## Types

### CreateBusinessSubcontractor

- `companyName` (string, required)
- `contactEmail` (string, required) — Matched case-insensitively against existing subcontractors' own default contact (never against contacts other organizations set privately). A match is not linked automatically: it returns `409 subcontractor_match` with the existing subcontractor's id in `details`, or `409 conflict` if it is already enrolled with your organization. Leading and trailing spaces are trimmed.
- `contactPhone` (string, required) — Required and unique across TradeGuard; used (with email) to match existing subcontractor identities, and for SMS outreach when `communicationPreference` includes SMS. Must be a real, dialable number: numbers without a country code are read as US numbers, and formatted input such as `(415) 555-1234` is accepted and stored in E.164 (`+14155551234`). Made-up numbers (for example an unassigned area code or exchange) are rejected with `400 validation_failed`, so in the sandbox use a realistic number such as `+1 415 555 01xx`.
- `entityType` (enum, required)
  - Allowed values: `llc`, `s_corp`, `c_corp`, `partnership`, `other`
- `businessAddress` (BusinessAddress, optional, nullable)
- `communicationPreference` (enum, optional)
  - Allowed values: `email`, `sms`, `both`
- `complianceProfileId` (string, optional) — Optionally attach a compliance profile on creation
- `contactName` (string, optional) — Your contact person. Defaults to firstName lastName.
- `createNew` (boolean, optional) — Create a separate subcontractor even though `contactEmail` or `contactPhone` matches one already on TradeGuard (for example, two companies sharing an office line). Without it, a match is a `409 subcontractor_match`.
- `dba` (string, optional, nullable) — Optional "doing business as" name. A certificate whose insured is the DBA matches the subcontractor.
- `ein` (string, optional, nullable) — Accepts `NN-NNNNNNN` or nine digits; stored normalized. A malformed EIN is rejected with **422**.
- `enforceEndorsementsAtRenewal` (boolean, optional) — Existing sub: enforce endorsements at renewal. Endorsement checks (additional insured, waiver of subrogation, primary & non-contributory, operations basis, form numbers, named parties and the notice-of-cancellation endorsement) on the policies the subcontractor has now read "Endorsement due at renewal (\<policy expiration>)" and don't count against it. A missing policy, low limits, an expired policy or no certificate are never deferred. Defaults to `true` when `origin` is `existing`, otherwise `false`.
- `externalId` (string, optional) — Your organization's own ID for the subcontractor (private to your organization).
- `firstName` (string, optional) — Optional contact person's first name
- `languagePreference` (enum, optional)
  - Allowed values: `en`, `es`
- `lastName` (string, optional) — Optional contact person's last name
- `licenses` (list of SubcontractorLicenseInput, optional)
- `metadata` (CreateBusinessSubcontractorMetadata, optional)
- `missingPoliciesAtRenewal` (list of enum, optional) — Existing sub: missing policies that wait until renewal. A required policy of one of these types that the subcontractor doesn't have at all reads "Policy due at renewal (\<date>)" and doesn't count against it until the subcontractor's next renewal: the earliest expiration date among its policies on file (for example, workers comp is asked for when the auto policy renews). With no policy dates on file it is required now. Low limits and expired or canceled policies are never deferred. Defaults to none.
  - Allowed values: `general_liability`, `workers_comp`, `automobile_liability`, `umbrella`, `professional_liability`, `medical_malpractice`, `directors_and_officers`, `employment_practices_liability`, `fiduciary_liability`, `cyber`, `technology_errors_omissions`, `media_liability`, `pollution_liability`, `liquor_liability`, `products_liability`, `owners_contractors_protective`, `railroad_protective`, `abuse_and_molestation`, `employee_benefits_liability`, `stop_gap_liability`, `foreign_liability`, `garage_liability`, `garagekeepers`, `riggers_liability`, `crime`, `fidelity_bond`, `surety_bond`, `commercial_property`, `builders_risk`, `installation_floater`, `equipment_floater`, `leased_rented_equipment`, `inland_marine`, `ocean_marine`, `motor_truck_cargo`, `cargo`, `warehouse_legal_liability`, `bailees_coverage`, `business_interruption`, `equipment_breakdown`, `flood`, `earthquake`, `physical_damage`, `trailer_interchange`, `non_trucking_liability`, `contingent_liability`, `occupational_accident`, `aviation`, `watercraft`, `uslh`, `maritime_employers_liability`, `disability`, `accident_health`
- `organizationId` (string, optional) — Optional — defaults to the organization your API key or session belongs to. If provided, it must belong to the caller.
- `origin` (enum, optional, default: new) — Your relationship with the subcontractor — `new` (onboarding tone) or `existing` (continuity tone); drives portal-invite copy. Ignored when an existing subcontractor is matched (the enrollment is then always `existing`).
  - Allowed values: `new`, `existing`
- `ownerEmail` (string, optional, nullable)
- `ownerName` (string, optional, nullable)
- `ownerPhone` (string, optional, nullable) — Any US-parsable format; stored E.164
- `tradeCategory` (enum, optional) — Optional trade/discipline of the subcontractor. Optional for API clients; the general-contractor web UI requires it when creating a subcontractor.
  - Allowed values: `electrical`, `plumbing`, `hvac`, `concrete`, `masonry`, `framing`, `roofing`, `drywall`, `painting`, `flooring`, `excavation`, `steel`, `landscaping`, `general`, `other`
- `website` (string, optional, nullable) — A bare host (`acme.example`) is accepted and stored as `https://acme.example`

### CreateIndividualSubcontractor

- `contactEmail` (string, required) — Matched case-insensitively against existing subcontractors' own default contact (never against contacts other organizations set privately). A match is not linked automatically: it returns `409 subcontractor_match` with the existing subcontractor's id in `details`, or `409 conflict` if it is already enrolled with your organization. Leading and trailing spaces are trimmed.
- `contactPhone` (string, required) — Required and unique across TradeGuard; used (with email) to match existing subcontractor identities, and for SMS outreach when `communicationPreference` includes SMS. Must be a real, dialable number: numbers without a country code are read as US numbers, and formatted input such as `(415) 555-1234` is accepted and stored in E.164 (`+14155551234`). Made-up numbers (for example an unassigned area code or exchange) are rejected with `400 validation_failed`, so in the sandbox use a realistic number such as `+1 415 555 01xx`.
- `entityType` (enum, required)
  - Allowed values: `sole_proprietor`
- `firstName` (string, required)
- `lastName` (string, required)
- `businessAddress` (BusinessAddress, optional, nullable)
- `communicationPreference` (enum, optional)
  - Allowed values: `email`, `sms`, `both`
- `complianceProfileId` (string, optional) — Optionally attach a compliance profile on creation
- `contactName` (string, optional) — Your contact person. Defaults to firstName lastName.
- `createNew` (boolean, optional) — Create a separate subcontractor even though `contactEmail` or `contactPhone` matches one already on TradeGuard (for example, two companies sharing an office line). Without it, a match is a `409 subcontractor_match`.
- `dba` (string, optional, nullable) — Optional "doing business as" name. A certificate whose insured is the DBA matches the subcontractor.
- `ein` (string, optional, nullable) — Accepts `NN-NNNNNNN` or nine digits; stored normalized. A malformed EIN is rejected with **422**.
- `enforceEndorsementsAtRenewal` (boolean, optional) — Existing sub: enforce endorsements at renewal. Endorsement checks (additional insured, waiver of subrogation, primary & non-contributory, operations basis, form numbers, named parties and the notice-of-cancellation endorsement) on the policies the subcontractor has now read "Endorsement due at renewal (\<policy expiration>)" and don't count against it. A missing policy, low limits, an expired policy or no certificate are never deferred. Defaults to `true` when `origin` is `existing`, otherwise `false`.
- `externalId` (string, optional) — Your organization's own ID for the subcontractor (private to your organization).
- `languagePreference` (enum, optional)
  - Allowed values: `en`, `es`
- `licenses` (list of SubcontractorLicenseInput, optional)
- `metadata` (CreateIndividualSubcontractorMetadata, optional)
- `missingPoliciesAtRenewal` (list of enum, optional) — Existing sub: missing policies that wait until renewal. A required policy of one of these types that the subcontractor doesn't have at all reads "Policy due at renewal (\<date>)" and doesn't count against it until the subcontractor's next renewal: the earliest expiration date among its policies on file (for example, workers comp is asked for when the auto policy renews). With no policy dates on file it is required now. Low limits and expired or canceled policies are never deferred. Defaults to none.
  - Allowed values: `general_liability`, `workers_comp`, `automobile_liability`, `umbrella`, `professional_liability`, `medical_malpractice`, `directors_and_officers`, `employment_practices_liability`, `fiduciary_liability`, `cyber`, `technology_errors_omissions`, `media_liability`, `pollution_liability`, `liquor_liability`, `products_liability`, `owners_contractors_protective`, `railroad_protective`, `abuse_and_molestation`, `employee_benefits_liability`, `stop_gap_liability`, `foreign_liability`, `garage_liability`, `garagekeepers`, `riggers_liability`, `crime`, `fidelity_bond`, `surety_bond`, `commercial_property`, `builders_risk`, `installation_floater`, `equipment_floater`, `leased_rented_equipment`, `inland_marine`, `ocean_marine`, `motor_truck_cargo`, `cargo`, `warehouse_legal_liability`, `bailees_coverage`, `business_interruption`, `equipment_breakdown`, `flood`, `earthquake`, `physical_damage`, `trailer_interchange`, `non_trucking_liability`, `contingent_liability`, `occupational_accident`, `aviation`, `watercraft`, `uslh`, `maritime_employers_liability`, `disability`, `accident_health`
- `organizationId` (string, optional) — Optional — defaults to the organization your API key or session belongs to. If provided, it must belong to the caller.
- `origin` (enum, optional, default: new) — Your relationship with the subcontractor — `new` (onboarding tone) or `existing` (continuity tone); drives portal-invite copy. Ignored when an existing subcontractor is matched (the enrollment is then always `existing`).
  - Allowed values: `new`, `existing`
- `ownerEmail` (string, optional, nullable)
- `ownerName` (string, optional, nullable)
- `ownerPhone` (string, optional, nullable) — Any US-parsable format; stored E.164
- `tradeCategory` (enum, optional) — Optional trade/discipline of the subcontractor. Optional for API clients; the general-contractor web UI requires it when creating a subcontractor.
  - Allowed values: `electrical`, `plumbing`, `hvac`, `concrete`, `masonry`, `framing`, `roofing`, `drywall`, `painting`, `flooring`, `excavation`, `steel`, `landscaping`, `general`, `other`
- `website` (string, optional, nullable) — A bare host (`acme.example`) is accepted and stored as `https://acme.example`

### AddExistingSubcontractor

Adds a subcontractor already on TradeGuard to your organization. Its shared company details are kept as they are; name, entity type and intake fields in this request are ignored (use [Update a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/update-subcontractor) to change them). Your contact fields are optional: any you leave out start as the subcontractor's default contact.

- `existingSubcontractorId` (string, required) — The `id` of a subcontractor from the lookup, or from a `subcontractor_match` error's `details`.
- `organizationId` (string, optional) — Optional — defaults to the organization your API key or session belongs to.
- `contactName` (string, optional) — Your contact person. Defaults to the subcontractor's default contact name.
- `contactEmail` (string, optional) — Your contact email for the subcontractor. Defaults to its default contact email.
- `contactPhone` (string, optional) — Your contact phone for the subcontractor. Defaults to its default contact phone.
- `externalId` (string, optional)
- `languagePreference` (enum, optional)
  - Allowed values: `en`, `es`
- `communicationPreference` (enum, optional)
  - Allowed values: `email`, `sms`, `both`
- `complianceProfileId` (string, optional)
- `origin` (enum, optional, default: new)
  - Allowed values: `new`, `existing`
- `enforceEndorsementsAtRenewal` (boolean, optional)
- `missingPoliciesAtRenewal` (list of string, optional)
- `metadata` (map from string to any, optional)

### V1SubcontractorsPostResponsesContentApplicationJsonSchemaData

Shared company details plus your organization's own contact, `externalId` and `metadata` (never another organization's).

- `id` (string, optional)
- `externalId` (string, optional, nullable) — Your organization's own ID for the subcontractor.
- `contactName` (string, optional, nullable) — Your organization's contact person for the subcontractor.
- `entityType` (enum, optional)
  - Allowed values: `sole_proprietor`, `llc`, `s_corp`, `c_corp`, `partnership`, `other`
- `companyName` (string, optional, nullable)
- `dba` (string, optional, nullable) — The subcontractor's "doing business as" name. A certificate whose insured is the DBA matches the subcontractor. Shared across organizations.
- `firstName` (string, optional, nullable)
- `lastName` (string, optional, nullable)
- `contactEmail` (string, optional) — Your organization's contact email for the subcontractor (invites and notices go here).
- `contactPhone` (string, optional) — Your organization's contact phone, E.164 format
- `communicationPreference` (enum, optional)
  - Allowed values: `email`, `sms`, `both`
- `languagePreference` (enum, optional)
  - Allowed values: `en`, `es`
- `tradeCategory` (enum, optional, nullable) — Optional trade/discipline of the subcontractor. Optional for API clients; the general-contractor web UI requires it when creating a subcontractor.
  - Allowed values: `electrical`, `plumbing`, `hvac`, `concrete`, `masonry`, `framing`, `roofing`, `drywall`, `painting`, `flooring`, `excavation`, `steel`, `landscaping`, `general`, `other`
- `ein` (string, optional, nullable) — Employer Identification Number, normalized to `NN-NNNNNNN`
- `website` (string, optional, nullable)
- `businessAddress` (BusinessAddress, optional, nullable) — Establishes the licensing jurisdiction for license verification
- `ownerName` (string, optional, nullable)
- `ownerEmail` (string, optional, nullable)
- `ownerPhone` (string, optional, nullable) — E.164 format
- `metadata` (V1SubcontractorsPostResponsesContentApplicationJsonSchemaDataMetadata, optional)
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional)
- `environment` (enum, optional) — Sandbox subcontractors are a separate set from production ones; a sandbox organization can never see or enroll a production subcontractor.
  - Allowed values: `production`, `sandbox`
- `informationNeeded` (list of ReportInformationNeededListItems, optional) — Secretary of State and license checks your compliance profiles require that can't run yet, with what to add to the subcontractor. Empty when nothing is missing. Add the fields with [Update a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/update-subcontractor); the check then runs automatically.
- `invite` (V1SubcontractorsPostResponsesContentApplicationJsonSchemaDataInvite, optional) — The automatic invite.

### ErrorDetailsItems

- `path` (string, optional)
- `message` (string, optional)

### BusinessAddress

- `line1` (string, required)
- `city` (string, required)
- `state` (string, required) — Two-letter USPS state / territory code
- `postalCode` (string, required) — 5-digit ZIP or ZIP+4
- `line2` (string, optional, nullable)
- `country` (enum, optional, default: US)
  - Allowed values: `US`

### SubcontractorLicenseInput

- `licenseNumber` (string, required)
- `licenseType` (string, required) — Free text (e.g. "Electrical Contractor") until the TradesAPI class taxonomy lands
- `state` (string, required) — Two-letter issuing state / territory code
- `isPrimary` (boolean, optional) — The license verified first. Exactly one per sub; defaults to the first row when none is flagged.

### CreateBusinessSubcontractorMetadata

### CreateIndividualSubcontractorMetadata

### V1SubcontractorsPostResponsesContentApplicationJsonSchemaDataMetadata

### ReportInformationNeededListItems

- `source` (enum, required) — A business-report source that evidences a requirement instead of a document
  - Allowed values: `cobalt_sos`, `tradesapi_license`, `jdp_background`, `web_research`
- `check` (string, required) — Plain-English name, e.g. `Secretary of State check`.
- `requirements` (list of string, required) — Titles of the requirements that use this check.
- `missing` (list of ReportInformationNeeded, required)

### V1SubcontractorsPostResponsesContentApplicationJsonSchemaDataInvite

The automatic invite.

- `status` (enum, required) — `started`: the invite goes out in the next sending window. `in_progress`: a conversation with this subcontractor already exists. `skipped`: no invite (see `reason`).
  - Allowed values: `started`, `in_progress`, `skipped`
- `conversationId` (string, optional) — Present unless `skipped`.
- `reason` (string, optional) — Why the invite was skipped: `customer_collects` (your organization collects documents itself), `enrollment_inactive`, `outreach_disabled`, `recipient_not_allowlisted`, `no_recipient` (no usable email), or `error` (it can be retried with the invite endpoint).

### ReportInformationNeeded

- `field` (enum, required) — The subcontractor field to fill in. New values may be added.
  - Allowed values: `companyName`, `businessAddress.state`, `tradeCategory`, `licenses[].state`
- `label` (string, required) — What to add, in plain English.

## Examples

**Request**

```json
{
  "companyName": "string",
  "contactEmail": "string",
  "contactPhone": "string",
  "entityType": "llc"
}
```

**Response**

```json
{
  "data": {
    "id": "string",
    "externalId": "string",
    "contactName": "string",
    "entityType": "sole_proprietor",
    "companyName": "string",
    "dba": "string",
    "firstName": "string",
    "lastName": "string",
    "contactEmail": "string",
    "contactPhone": "string",
    "communicationPreference": "email",
    "languagePreference": "en",
    "tradeCategory": "electrical",
    "ein": "12-3456789",
    "website": "string",
    "businessAddress": {
      "line1": "string",
      "city": "string",
      "state": "TX",
      "postalCode": "78701",
      "line2": "string",
      "country": "US"
    },
    "ownerName": "string",
    "ownerEmail": "string",
    "ownerPhone": "string",
    "metadata": {},
    "createdAt": "2024-01-15T09:30:00Z",
    "updatedAt": "2024-01-15T09:30:00Z",
    "environment": "production",
    "informationNeeded": [
      {
        "source": "cobalt_sos",
        "check": "string",
        "requirements": [
          "string"
        ],
        "missing": [
          {
            "field": "companyName",
            "label": "string"
          }
        ]
      }
    ],
    "invite": {
      "status": "started",
      "conversationId": "string",
      "reason": "string"
    }
  },
  "matchedExisting": true
}
```

**SDK Code**

```python
import requests

url = "https://api.tradeguardins.com/v1/subcontractors"

payload = {
    "companyName": "string",
    "contactEmail": "string",
    "contactPhone": "string",
    "entityType": "llc"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.tradeguardins.com/v1/subcontractors';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"companyName":"string","contactEmail":"string","contactPhone":"string","entityType":"llc"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.tradeguardins.com/v1/subcontractors"

	payload := strings.NewReader("{\n  \"companyName\": \"string\",\n  \"contactEmail\": \"string\",\n  \"contactPhone\": \"string\",\n  \"entityType\": \"llc\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.tradeguardins.com/v1/subcontractors")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"companyName\": \"string\",\n  \"contactEmail\": \"string\",\n  \"contactPhone\": \"string\",\n  \"entityType\": \"llc\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.tradeguardins.com/v1/subcontractors")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"companyName\": \"string\",\n  \"contactEmail\": \"string\",\n  \"contactPhone\": \"string\",\n  \"entityType\": \"llc\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.tradeguardins.com/v1/subcontractors', [
  'body' => '{
  "companyName": "string",
  "contactEmail": "string",
  "contactPhone": "string",
  "entityType": "llc"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.tradeguardins.com/v1/subcontractors");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"companyName\": \"string\",\n  \"contactEmail\": \"string\",\n  \"contactPhone\": \"string\",\n  \"entityType\": \"llc\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "companyName": "string",
  "contactEmail": "string",
  "contactPhone": "string",
  "entityType": "llc"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.tradeguardins.com/v1/subcontractors")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```