# API Reference

> Endpoint reference for the InsureTrek Bridge API: authentication, accounts, producer onboarding and lookup, bulk onboarding, subscriptions, and territories.

OpenAPI spec: [insuretrek.com/docs/openapi.json](/docs/openapi.json)

## Auth

* `POST /v1/auth/login`: Log in a user using client credentials  
This endpoint logs in a user by validating client credentials and generating an access token.

## Account

* `PATCH /v1/account`: Update user details  
This endpoint allows authenticated clients to update an existing user details. Requires a valid Bearer token.
* `POST /v1/account/account-credential`: Create user credentials  
Generates and returns credentials for the specified user.
* `PATCH /v1/account/reset-credential`: Reset user password  
Allows an authenticated user to reset their password.

## Producer

* `POST /v1/account/producer`: Lookup, subscribe, or team-onboard a producer  
Onboards a producer by NPN. Supports three onboard types: 'lookup' (read-only check), 'subscribe' (full subscription), and 'team' (team member onboard with payment and personal details). When onboardType is 'team', the fields paymentResponsibility, email, firstName, lastName, phone, gender, and ssn become available. paymentResponsibility is required for team and must be 'agency' or 'producer'.
* `GET /v1/account/producer/bulk/details/{id}`: Get Bulk Onboarding Details  
Returns bulk report details based on the onboarding status (in-progress or completed). Results are paginated with a default page size of 50.
* `POST /v1/account/producer/bulk/onboard`: Bulk onboard producers  
Initiates bulk onboarding for a list of NPNs based on the provided onboarding type. \*\*Examples:\*\* - \*\*Lookup Onboard\*\* { "npn": \[1234567, 7654321\], "onboardType": "lookup" } - \*\*Subscribe Onboard\*\* { "npn": \[5555555, 6666666\], "onboardType": "subscribe" }
* `GET /v1/account/producer/bulk/status/{id}`: Get the status of a bulk onboarding process  
Fetches the current status of a bulk onboarding process using the bulk onboarding ID. \*\*Examples:\*\* - \*\*In Progress\*\* { "id": "661e68abde6fd2c2a2e037b5", "successCount": 0, "failureCount": 0, "message": "Onboarding the producers. please try again" } - \*\*Completed\*\* { "id": "661e68abde6fd2c2a2e037b5", "npns": \["1234567", "7654321"\], "totalCount": 2, "successCount": 1, "failureCount": 1, "failedNpns": \[ 1234567 \] }
* `GET /v1/account/producer/license/active`: Get active licenses for given state codes  
Returns a list of active licenses associated with the user for the specified state codes
* `POST /v1/account/producer/npn-lookup`: Lookup NPN by SSN and last name  
Looks up a producer's NPN using their SSN and last name via NIPR
* `POST /v1/account/producer/subscription-update`: Get latest update for an npn  
This endpoint allows clients to get latest updates for the npns they have subscribed for

## Subscription

* `POST /v1/subscribe`: Add or update subscription targets  
Adds or updates subscription targets (NPNS) for the given agency
* `DELETE /v1/unsubscribe`: Remove subscription targets  
Removes subscription targets (NPNS) for the given agency

## Territory

* `POST /v1/account/producer/{npn}/territories`: Assign a territory to a producer  
Assigns a territory to a producer by NPN, merging with existing assignments
* `DELETE /v1/account/producer/{npn}/territories/{territoryId}`: Unassign a territory from a producer  
Removes a territory assignment from a producer by NPN
* `GET /v1/account/territories`: Get territories for an agency  
Returns a paginated list of territories with states, licenses, LOAs, and assigned producers
