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

# Invite a subcontractor

POST https://api.tradeguardins.com/v1/subcontractors/{subcontractorId}/invite
Content-Type: application/json

Starts TradeGuard's conversation with the subcontractor for your organization. Its first email is the invite: Jake from TradeGuard tells the subcontractor what your organization needs, lists everything still missing, and links to the subcontractor's own portal, where they can upload documents and see what's left (no password). If they don't respond, Jake follows up with up to three reminders, two business days apart, in the same email thread.

You don't usually need this call: [creating a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/create-subcontractor) invites it automatically (see `invite` in that response). Use it to invite a subcontractor whose automatic invite was skipped, or to send the invite again.

* **First call:** the conversation starts and the invite goes out in the next sending window (business days, 8 AM to 6 PM US Central). `status` is `started`.
* **Before the first email has gone out:** nothing new is sent. `status` is `in_progress`.
* **After the first email:** the invite is sent again in the same thread, at most once a day. `status` is `resent`; a second call the same day sends nothing and returns `already_resent_today`. The reminder schedule is unchanged.

The email goes to your organization's `contactEmail` for the subcontractor, in the subcontractor's `languagePreference` (English or Spanish).

**Who collects documents.** Invites run only when TradeGuard collects documents for your organization ([Who collects documents](/getting-started/who-collects-documents)). If your organization collects them itself, this returns **409** and nothing is sent; create an upload link (`POST /v1/subcontractors/{subcontractorId}/upload-link`) and send it to the subcontractor yourself.

**Sandbox:** no email is ever sent. The emails are written to the conversation as simulated, so you can follow the whole flow; a re-send returns `status: simulated`.

Side effects: the enrollment's `invitedBy` and `metadata.subInvite` (`requestedAt`, `requestedBy`, `conversationId`, `recipientEmail`) are updated, and a `subcontractor.invited` audit event is written. The emails appear in the [communications](https://docs.tradeguardins.com/api-reference/subcontractors/list-subcontractor-communications) list once sent.

The request body is optional and ignored; a missing or non-JSON body is treated as `{}`. `appUrl` from the earlier invite flow is still accepted for compatibility but has no effect.

Requires scope `subcontractors:write`.

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

## Authentication

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

## Request

### Path parameters

- `subcontractorId` (string, required)

### Body (application/json)

This endpoint expects an object.

- `appUrl` (string, optional, deprecated) — No longer used; the link in the email is the subcontractor's own portal link.

## Response

### 200

The invite started, was already on its way, or was sent again

- `data` (V1SubcontractorsSubcontractorIdInvitePostResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 400 Bad Request Error

The subcontractor has no contact email (`bad_request`); a present-but-invalid `appUrl` string fails schema validation (`validation_failed`); a non-UUID `subcontractorId` is `invalid_identifier`.

- `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

Nothing was sent (`conflict`): your organization collects documents itself (use an upload link instead), the subcontractor is inactive for your organization, outreach is switched off, or a re-send couldn't go out. The message says which.

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

### 500 Internal Server Error

Unexpected server error (`internal_error`); safe to retry idempotent requests

- `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

### V1SubcontractorsSubcontractorIdInvitePostResponsesContentApplicationJsonSchemaData

- `enrollment` (Enrollment, required) — The link between your organization and a subcontractor (one row per organization × subcontractor). Status, condition flags and portal-invite state are organization-scoped; the subcontractor record itself is shared.
- `status` (enum, required) — `started`: the conversation began and the invite goes out in the next sending window. `in_progress`: the invite was already on its way; nothing new was sent. `resent`: the invite was sent again in the same thread. `already_resent_today`: today's one re-send already went out; nothing new was sent. `simulated`: sandbox re-send; nothing was emailed.
  - Allowed values: `started`, `in_progress`, `resent`, `already_resent_today`, `simulated`
- `conversationId` (string, required) — The conversation with this subcontractor for your organization.
- `conversationStatus` (enum, required) — Where the conversation stands.
  - Allowed values: `active`, `paused`, `held`, `escalated`, `bounced`, `closed`
- `nextStepAt` (datetime, required, nullable) — When the next email or step is due, if one is scheduled.
- `communicationId` (string, required, nullable) — The `communications` entry for a re-sent invite. Null when the invite is still scheduled.
- `recipientEmail` (string, required) — Your organization's `contactEmail` for the subcontractor, which the invite goes to.

### ErrorDetailsItems

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

### Enrollment

The link between your organization and a subcontractor (one row per organization × subcontractor). Status, condition flags and portal-invite state are organization-scoped; the subcontractor record itself is shared.

- `id` (string, optional)
- `organizationId` (string, optional)
- `subcontractorId` (string, optional)
- `status` (enum, optional)
  - Allowed values: `active`, `inactive`
- `origin` (string, optional) — Relationship origin from your side — `new` (onboarding tone) or `existing` (continuity tone). Open-ended; other values may appear.
- `invitedAt` (datetime, optional) — When the latest portal invite was sent (defaults to the enrollment's creation time).
- `invitedBy` (string, optional, nullable) — Clerk user id (or API key subject) that sent the latest invite.
- `onboardedAt` (datetime, optional, nullable)
- `inviteToken` (string, optional, nullable) — The current single-use portal invite token.
- `conditionFlags` (list of string, optional) — Condition keys your organization has set for this subcontractor (see GET /v1/meta/condition-keys).
- `enforceEndorsementsAtRenewal` (boolean, optional) — Existing sub, endorsement checks wait for each policy's renewal (see `enforceEndorsementsAtRenewal` on [Create a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/create-subcontractor)). A policy that took effect after `endorsementsAtRenewalSince` is a renewal, and its endorsements are checked as normal.
- `endorsementsAtRenewalSince` (datetime, optional, nullable) — When `enforceEndorsementsAtRenewal` was turned on.
- `missingPoliciesAtRenewal` (list of enum, optional) — Existing sub, these missing policy types wait until the subcontractor's next renewal (see `missingPoliciesAtRenewal` on [Create a subcontractor](https://docs.tradeguardins.com/api-reference/subcontractors/create-subcontractor)). Empty when 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`
- `contactName` (string, optional, nullable) — Your organization's contact person (surfaced on the subcontractor as `contactName`).
- `contactEmail` (string, optional, nullable) — Your organization's contact email (surfaced on the subcontractor as `contactEmail`).
- `contactPhone` (string, optional, nullable) — Your organization's contact phone (surfaced on the subcontractor as `contactPhone`).
- `externalId` (string, optional, nullable) — Your organization's own ID (surfaced on the subcontractor as `externalId`).
- `gcMetadata` (EnrollmentGcMetadata, optional) — Your organization's own metadata (surfaced on the subcontractor as `metadata`).
- `metadata` (EnrollmentMetadata, optional) — Internal invite bookkeeping. After an invite, `metadata.subInvite` holds `sentAt`, `sentBy`, `expiresAt`, `acceptedAt`, `acceptedBy`, `recipientEmail`, and `revokedAt` / `revokedReason` when a contact-email change voided it.
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional)

### EnrollmentGcMetadata

Your organization's own metadata (surfaced on the subcontractor as `metadata`).

### EnrollmentMetadata

Internal invite bookkeeping. After an invite, `metadata.subInvite` holds `sentAt`, `sentBy`, `expiresAt`, `acceptedAt`, `acceptedBy`, `recipientEmail`, and `revokedAt` / `revokedReason` when a contact-email change voided it.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "enrollment": {
      "id": "string",
      "organizationId": "string",
      "subcontractorId": "string",
      "status": "active",
      "origin": "new",
      "invitedAt": "2024-01-15T09:30:00Z",
      "invitedBy": "string",
      "onboardedAt": "2024-01-15T09:30:00Z",
      "inviteToken": "string",
      "conditionFlags": [
        "string"
      ],
      "enforceEndorsementsAtRenewal": true,
      "endorsementsAtRenewalSince": "2024-01-15T09:30:00Z",
      "missingPoliciesAtRenewal": [
        "general_liability"
      ],
      "contactName": "string",
      "contactEmail": "string",
      "contactPhone": "string",
      "externalId": "string",
      "gcMetadata": {},
      "metadata": {},
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z"
    },
    "status": "started",
    "conversationId": "string",
    "conversationStatus": "active",
    "nextStepAt": "2024-01-15T09:30:00Z",
    "communicationId": "string",
    "recipientEmail": "string"
  }
}
```

**SDK Code**

```python
import requests

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

payload = {}
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/subcontractorId/invite';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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/subcontractorId/invite"

	payload := strings.NewReader("{}")

	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/subcontractorId/invite")

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 = "{}"

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/subcontractorId/invite")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.tradeguardins.com/v1/subcontractors/subcontractorId/invite")! 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()
```