<!-- Generated by scripts/build-docs.js. Edit docs/swagger.yaml or docs/guides/, then run `npm run docs:build`. -->

# Get a sale

`GET https://marketplace-api.sequifi.com/v1/sales/{pid}`

Module: Sales · operationId: `getSale` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/get-sale

Returns one processed sale by its `pid`, with the same fields as an item of `GET /v1/sales`. Use it to confirm that a sale sent with `POST /v1/sales` was processed. A `404` shortly after a successful POST is normal: the sale appears only after background processing.

**Before you call:**

- Not available to SequiPay companies (`403`).
- URL-encode the pid. A pid that contains `/` may not reach this route; use `GET /v1/sales?pid=<pid>` instead.

**What happens:**

- Read-only. Returns `data.sale` (singular) and `data.requestedBy`, with no paging fields.
- The pid must match exactly.
- `job_status` is calculated when you read it, and `all_milestone[]` has one entry per commission line (see `GET /v1/sales`).

**Formats:**

- Dates are midnight UTC timestamps such as `2026-05-01T00:00:00.000Z`; compare the first 10 characters with the date you sent.
- Mortgage `net_epc` is returned multiplied by 100. See `Sale` for the type of every field.

**Errors:**

- `400 Cannot use query parameters when fetching a single sale by pid`: any query parameter was sent.
- `401`: missing, invalid or expired token. The body is `{"message": "Unauthorized"}`.
- `403 Forbidden: This endpoint is not available for SequiPay companies`.
- `404 Sale not found`: the pid is unknown, still queued, or was rejected during processing. The API cannot tell these apart.
- `500`: retry later.

**Common mistakes:**

- Resending a record because this returns `404` right after the POST. Wait. If it is still `404` a few hours later, processing rejected it: send the pid to Sequifi support.
- Comparing `job_status`, or mortgage `net_epc`, with what you sent.
- Expecting exactly one `all_milestone[]` entry per milestone. Entries repeat per commission line, and a sale with no commission lines has none. Compare dates with `milestone_dates[]` instead.

**Related:**

- `POST /v1/sales`: create or update the sale.
- `GET /v1/sales`: list and filter sales.

## Path parameters

- `pid` (string, **required**): Your sale id, exactly as sent on `POST /v1/sales`. URL-encode it. Example: `SALE-10482`.

## Example request

```bash
curl -X GET "https://marketplace-api.sequifi.com/v1/sales/SALE-10482" \
  -H "Authorization: Bearer $SEQUIFI_TOKEN"
```

## Responses

### 200: The sale.

- `status` (integer): The HTTP status code, repeated. Example: `200`.
- `message` (string): Short text. Wording varies by endpoint; branch on the HTTP status, not on this text. Example: `success`.
- `data` (object)
  - `requestedBy` (string): Name of the API credential that made the call.
  - `sale` (object): A processed sale as Sequifi holds it now, returned by `GET /v1/sales` and `GET /v1/sales/{pid}`. Every field is always present, with `null` when empty.
    - `id` (integer): Sequifi's sale id. Not the `id` in the `POST /v1/sales` response.
    - `pid` (string): Your sale id, as sent on `POST /v1/sales`.
    - `customer_name` (string): Customer (borrower) name.
    - `data_source_type` (string, nullable): Where the sale came from. `Marketplace API` for sales sent through this API.
    - `job_status` (string): Calculated when you read it, in this order: `Clawback` when a clawback is shown on the sale, else `Cancelled` when `date_cancelled` is set, else `Serviced` when any milestone date is set, else `Pending`. A `job_status` you sent is not returned. One of: `Pending`, `Serviced`, `Cancelled`, `Clawback`.
    - `product_id` (integer, nullable): The product `id`. When Sequifi recorded an original product for the sale, this and the other product fields show that original product.
    - `product_code` (string, nullable): The product code.
    - `product_name` (string): `Name - CODE`, or `Sale product name (Name) - CODE` when the product name you sent differs. Empty when the sale has no product.
    - `org_product_id` (string, nullable): The product code (despite the field name).
    - `customer_state` (string, nullable): Customer state.
    - `customer_address` (string, nullable): Street address, as sent on `POST /v1/sales`.
    - `customer_address_2` (string, nullable): Second address line, such as a unit number.
    - `customer_city` (string, nullable): Customer city.
    - `customer_zip` (string, nullable): Customer ZIP code.
    - `customer_phone` (string, nullable): Customer phone number, as sent.
    - `customer_email` (string, nullable): Customer email address.
    - `last_milestone` (object, nullable): The milestone line with the latest date (ties go to the larger amount). `null` when no milestone has a date.
      - `name` (string): Milestone name.
      - `trigger` (string): Label of the date that triggers the milestone.
      - `value` (number): Amount of this line in dollars.
      - `date` (string (date-time)): Milestone date as a midnight UTC timestamp.
    - `last_payment` (number): The amount of `last_milestone`, or `0` when no milestone has a date.
    - `all_milestone` (array of object): One entry per commission line on the sale, so the same milestone can appear more than once (for example once for the closer and once for the setter). A sale with no commission lines has none. An extra entry named `Recon` is added when reconciliation is on.
      - `name` (string, nullable): Milestone name, or `Recon` for the reconciliation entry.
      - `trigger` (string, nullable): Label of the date that triggers the milestone. `null` for `Recon`.
      - `milestone_id` (integer, nullable): The milestone's id, the same `milestone_id` you send in `milestone_dates[]`. `null` for `Recon`.
      - `value` (number): Amount of this line in dollars.
      - `date` (string (date-time), nullable): Milestone date as a midnight UTC timestamp, or `null` when not reached.
      - `is_projected` (integer): `1` when the amount is projected, `0` when final.
      - `status` (string, nullable): Payroll status of this rep's pay for the milestone. When the rep has more than one line for it (for example an M2 and an M2 update), the least settled one wins, in this order: `pending`, `approved`, `paid`, `do_not_pay`. `projected` when there is no line yet and the milestone is projected; `null` when there is no line and the milestone has a date, and for `Recon`. See `SaleCommissionLine`. One of: `paid`, `approved`, `pending`, `do_not_pay`, `projected`, `null`.
    - `milestone_dates` (array of object): The sale's milestone dates in the shape `POST /v1/sales` takes, one entry per milestone. Includes dates on sales that have no `all_milestone[]` entries.
      - `product_id` (integer, nullable): Product id.
      - `milestone_id` (integer): Milestone id.
      - `milestone_date` (string (date), nullable): `YYYY-MM-DD`, or `null` when the milestone has no date.
    - `commission_lines` (array of object): Every commission and override line on the sale, with its payroll status. Empty when the sale has none.
      - `type` (string) One of: `commission`, `override`.
      - `milestone` (string, nullable): Milestone the line pays on, such as `m1`, `m2` or `m2 update`.
      - `milestone_id` (integer, nullable): Milestone id for commission lines. `null` for overrides.
      - `user_id` (integer): The user paid by this line.
      - `amount` (number): Amount in dollars. `0` when the line has no amount.
      - `status` (string): `paid`: settled on a payroll that ran, or marked paid. `approved`: on a payroll that is finalized or being paid. `pending`: on an open payroll, or not on a payroll yet. `do_not_pay`: closed without paying the rep. One of: `paid`, `approved`, `pending`, `do_not_pay`.
      - `pay_period_from` (string (date), nullable)
      - `pay_period_to` (string (date), nullable)
    - `total_commission` (string): Total commission in dollars with 2 decimals, including reconciliation.
    - `projected_commission` (integer): `1` when the commission amounts are still projected, `0` when final. A flag, not an amount.
    - `total_override` (string): Total override in dollars.
    - `projected_override` (integer): `1` when the override amounts are still projected, `0` when final.
    - `kw` (string, nullable): System size in kW (square feet for Turf and Roofing), as text.
    - `epc` (string, nullable): Gross price per unit, as text with 4 decimals.
    - `net_epc` (number, nullable): Net price per unit. For Mortgage it is returned multiplied by 100, so it does not equal the value you sent.
    - `adders` (string, nullable): Adders total, as text.
    - `gross_account_value` (number, nullable): Gross account value (loan amount for Mortgage) in dollars.
    - `service_completed` (string, nullable): Number of services completed, as text.
    - `date_cancelled` (string (date-time), nullable): Cancellation date as a midnight UTC timestamp.
    - `customer_signoff` (string (date-time), nullable): Sale date (closing date for Mortgage) as a midnight UTC timestamp, for example `2026-05-01T00:00:00.000Z`. Compare the first 10 characters with the date you sent.
    - `install_partner` (string, nullable): Installer, service provider or broker.
    - `service_schedule` (string, nullable): Service schedule (loan type for Mortgage).
    - `length_of_agreement` (string, nullable): Length of the service agreement.
    - `initial_service_cost` (string, nullable): Up-front service cost, as text.
    - `subscription_payment` (string, nullable): Recurring subscription payment, as text.
    - `card_on_file` (string, nullable): Whether a card is on file, as stored text.
    - `auto_pay` (string, nullable): Whether autopay is on, as stored text.
    - `bill_status` (string, nullable): Billing status label.
    - `balance_age` (string, nullable): Age of the outstanding balance in days, as text.
    - `last_service_date` (string (date-time), nullable): Last service date as a midnight UTC timestamp.
    - `dealer_fee_amount` (string, nullable): Dealer fee in dollars, as text.
    - `dealer_fee_percentage` (string, nullable): Dealer fee as a fraction, as text.
    - `is_exempted` (integer): `1` when the sale is exempt from clawback, else `0`.
    - `sales_type` (string): Sale type label, for example `Sales`.
    - `created_at` (string (date-time)): When Sequifi created the sale (UTC).
    - `updated_at` (string (date-time)): When Sequifi last changed the sale (UTC). Use it with `updated_after` to poll.
    - `mark_account_status_name` (string, nullable): `Clawed Back` when a clawback is shown, `Paid` when any commission on the sale has been paid, else `null`. One of: `Clawed Back`, `Paid`, `null`.
    - `closer1_detail` (object, nullable): Closer 1, or `null`.
      - `id` (integer): User id.
      - `first_name` (string): First name.
      - `last_name` (string): Last name.
      - `dismiss` (integer): `1` when the user is dismissed.
      - `terminate` (integer): `1` when the user is terminated.
      - `contract_ended` (integer): `1` when the user's contract has ended.
      - `stop_payroll` (integer): `1` when payroll is stopped for the user.
    - `closer2_detail` (object, nullable): Closer 2, or `null`.
      - `id` (integer): User id.
      - `first_name` (string): First name.
      - `last_name` (string): Last name.
      - `dismiss` (integer): `1` when the user is dismissed.
      - `terminate` (integer): `1` when the user is terminated.
      - `contract_ended` (integer): `1` when the user's contract has ended.
      - `stop_payroll` (integer): `1` when payroll is stopped for the user.
    - `setter1_detail` (object, nullable): Setter 1, or `null`.
      - `id` (integer): User id.
      - `first_name` (string): First name.
      - `last_name` (string): Last name.
      - `dismiss` (integer): `1` when the user is dismissed.
      - `terminate` (integer): `1` when the user is terminated.
      - `contract_ended` (integer): `1` when the user's contract has ended.
      - `stop_payroll` (integer): `1` when payroll is stopped for the user.
    - `setter2_detail` (object, nullable): Setter 2, or `null`.
      - `id` (integer): User id.
      - `first_name` (string): First name.
      - `last_name` (string): Last name.
      - `dismiss` (integer): `1` when the user is dismissed.
      - `terminate` (integer): `1` when the user is terminated.
      - `contract_ended` (integer): `1` when the user's contract has ended.
      - `stop_payroll` (integer): `1` when payroll is stopped for the user.
    - `custom_field_values` (object): The sale's current custom field values keyed by field name (as in `GET /v1/custom-fields?type=sales`), including edits made in the app. Values are returned as stored: numbers as numbers, dates as `YYYY-MM-DD`, multi-select values as arrays. `{}` when the sale has none; fields deleted from your configuration are left out.

```json
{
  "status": 200,
  "message": "Successfully",
  "data": {
    "requestedBy": "acme",
    "sale": {
      "id": 7731,
      "pid": "SALE-10482",
      "customer_name": "Alex Morgan",
      "data_source_type": "Marketplace API",
      "job_status": "Serviced",
      "product_id": 12,
      "product_code": "SOL-ROOF",
      "product_name": "Solar Rooftop - SOL-ROOF",
      "org_product_id": "SOL-ROOF",
      "customer_state": "AZ",
      "customer_address": "1200 Desert Willow Rd",
      "customer_address_2": null,
      "customer_city": "Phoenix",
      "customer_zip": "85001",
      "customer_phone": "555-010-4821",
      "customer_email": "alex.morgan@example.com",
      "last_milestone": {
        "name": "Site Survey",
        "trigger": "Site Survey Date",
        "value": 500,
        "date": "2026-05-08T00:00:00.000Z"
      },
      "last_payment": 500,
      "all_milestone": [
        {
          "name": "Site Survey",
          "trigger": "Site Survey Date",
          "milestone_id": 41,
          "value": 500,
          "date": "2026-05-08T00:00:00.000Z",
          "is_projected": 0,
          "status": "paid"
        },
        {
          "name": "Install",
          "trigger": "Install Date",
          "milestone_id": 42,
          "value": 750,
          "date": null,
          "is_projected": 1,
          "status": "projected"
        }
      ],
      "milestone_dates": [
        {
          "product_id": 12,
          "milestone_id": 41,
          "milestone_date": "2026-05-08"
        },
        {
          "product_id": 12,
          "milestone_id": 42,
          "milestone_date": null
        }
      ],
      "commission_lines": [
        {
          "type": "commission",
          "milestone": "m1",
          "milestone_id": 41,
          "user_id": 101,
          "amount": 500,
          "status": "paid",
          "pay_period_from": "2026-05-04",
          "pay_period_to": "2026-05-10"
        }
      ],
      "total_commission": "1250.00",
      "projected_commission": 1,
      "total_override": "0",
      "projected_override": 1,
      "kw": "7.2",
      "epc": "3.8500",
      "net_epc": 3.2,
      "adders": "1100",
      "gross_account_value": 27720,
      "service_completed": null,
      "date_cancelled": null,
      "customer_signoff": "2026-05-01T00:00:00.000Z",
      "install_partner": "Brightline Solar",
      "service_schedule": null,
      "length_of_agreement": null,
      "initial_service_cost": null,
      "subscription_payment": null,
      "card_on_file": null,
      "auto_pay": null,
      "bill_status": null,
      "balance_age": null,
      "last_service_date": null,
      "dealer_fee_amount": "4158",
      "dealer_fee_percentage": "0.15",
      "is_exempted": 0,
      "sales_type": "Sales",
      "created_at": "2026-05-01T16:05:43.000Z",
      "updated_at": "2026-05-08T18:12:09.000Z",
      "mark_account_status_name": "Paid",
      "closer1_detail": {
        "id": 4821,
        "first_name": "Jordan",
        "last_name": "Reyes",
        "dismiss": 0,
        "terminate": 0,
        "contract_ended": 0,
        "stop_payroll": 0
      },
      "closer2_detail": null,
      "setter1_detail": {
        "id": 5310,
        "first_name": "Casey",
        "last_name": "Lee",
        "dismiss": 0,
        "terminate": 0,
        "contract_ended": 0,
        "stop_payroll": 0
      },
      "setter2_detail": null,
      "custom_field_values": {
        "Roof Type": "Shingle",
        "Panel Count": 18
      }
    }
  }
}
```

### 400: A query parameter was sent with the pid.

```json
{
  "status": 400,
  "message": "Cannot use query parameters when fetching a single sale by pid",
  "data": {}
}
```

### 401: Missing, invalid or expired token. The body has only `message`.

```json
{
  "message": "Unauthorized"
}
```

### 403: SequiPay companies cannot use this endpoint.

```json
{
  "status": 403,
  "message": "Forbidden: This endpoint is not available for SequiPay companies",
  "data": {}
}
```

### 404: The pid is unknown, still queued, or was rejected during processing.

```json
{
  "status": 404,
  "message": "Sale not found",
  "data": {}
}
```

### 500: Server error. Retry later.

```json
{
  "status": 500,
  "message": "Internal Server Error",
  "data": {}
}
```
