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

# Create Service Line

POST https://api.joincandidhealth.com/api/service-lines/v2
Content-Type: application/json

Reference: https://docs.joincandidhealth.com/api-reference/service-lines/v-2/create

## Authentication

- OAuth2 — send the obtained token as `Authorization: Bearer <token>`

## Servers

- `https://api.joincandidhealth.com` (Production, default)
- `https://api-staging.joincandidhealth.com` (Staging)
- `https://sandbox-api.joincandidhealth.com` (CandidSandbox)
- `https://staging-api.joincandidhealth.com` (CandidStaging)
- `http://localhost:5050` (Local)

## Request

### Body (application/json)

This endpoint expects a ServiceLineCreateStandalone.

- `claim_id` (UUID, required)
- `procedure_code` (string, required)
- `quantity` (string, required) — String representation of a Decimal that can be parsed by most libraries. For professional claims, a ServiceLine quantity cannot contain more than one digit of precision (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine quantity cannot contain more than three decimal digits of precision.
- `units` (enum, required)
  - Allowed values: `MJ`, `UN`
- `charge_amount_cents` (integer, optional) — The total amount charged for this service line, factoring in quantity. The system will attempt to set it based on the chargemaster configuration and the service line’s quantity. For example, if a single unit has an entry of 100 cents and 2 units were rendered, the charge_amount_cents will be set to 200. If there is no chargemaster entry, the system will default to the amount set via this field.
- `custom_procedure_code` (string, optional) — Represents and preserves the custom CPT code received on this service line. Custom CPT codes are specific to your organization and are primarily used for rules and reporting purposes.
- `date_of_service` (date, optional)
- `denial_reason` (ServiceLineDenialReason, optional) — The reason a given service line was denied within a given time range. A service line may be denied for different reasons over time, but only one reason at a time.
- `description` (string, optional) — A free-form description to clarify the related data elements and their content. Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
- `diagnosis_id_one` (UUID, optional)
- `diagnosis_id_three` (UUID, optional)
- `diagnosis_id_two` (UUID, optional)
- `diagnosis_id_zero` (UUID, optional)
- `drug_identification` (DrugIdentification, optional)
- `end_date_of_service` (date, optional)
- `external_id` (string, optional) — An external identifier for this service line. This is not used in the EDI 837, but can be used to identify the service line in external systems. This field should not contain PHI. Must be unique on a given claim.
- `has_epsdt_indicator` (boolean, optional) — Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500. If the value is true, the box will be populated with "Y". Otherwise, the box will not be populated.
- `has_family_planning_indicator` (boolean, optional) — Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500. If the value is true, the box will be populated with "Y". Otherwise, the box will not be populated.
- `modifiers` (list of enum, optional)
  - Allowed values: `AV`, `AU`, `AW`, `AY`, `07`, `08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `22`, `23`, `24`, `25`, `26`, `27`, `28`, `32`, `33`, `47`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `62`, `63`, `66`, `73`, `74`, `76`, `77`, `78`, `79`, `80`, `81`, `82`, `90`, `91`, `92`, `93`, `95`, `96`, `97`, `99`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, `A7`, `A8`, `A9`, `AA`, `AB`, `AD`, `AE`, `AF`, `AG`, `AH`, `AI`, `AJ`, `AK`, `AM`, `AO`, `AP`, `AQ`, `AR`, `AS`, `AT`, `AZ`, `BA`, `BL`, `BO`, `BP`, `BR`, `BU`, `CA`, `CB`, `CC`, `CD`, `CE`, `CF`, `CG`, `CH`, `CI`, `CJ`, `CK`, `CL`, `CM`, `CN`, `CR`, `CS`, `CT`, `CO`, `CQ`, `DA`, `E1`, `E2`, `E3`, `E4`, `EA`, `EB`, `EC`, `ED`, `EE`, `EJ`, `EM`, `EP`, `ER`, `ET`, `EV`, `EX`, `EY`, `F1`, `F2`, `F3`, `F4`, `F5`, `F6`, `F7`, `F8`, `F9`, `FA`, `FB`, `FC`, `FP`, `FQ`, `FR`, `FS`, `FT`, `FX`, `FY`, `G0`, `G1`, `G2`, `G3`, `G4`, `G5`, `G6`, `G7`, `G8`, `G9`, `GA`, `GB`, `GC`, `GE`, `GF`, `GG`, `GH`, `GJ`, `GK`, `GL`, `GM`, `GN`, `GO`, `GP`, `GQ`, `GR`, `GS`, `GT`, `GU`, `GV`, `GW`, `GX`, `GY`, `GZ`, `HA`, `HB`, `HC`, `HD`, `HE`, `HF`, `HG`, `HH`, `HI`, `HJ`, `HK`, `HL`, `HM`, `HN`, `HO`, `HP`, `HQ`, `HR`, `HS`, `HT`, `HU`, `HV`, `HW`, `HX`, `HY`, `HZ`, `J1`, `J2`, `J3`, `J4`, `J5`, `JA`, `JB`, `JC`, `JD`, `JE`, `JG`, `JW`, `JZ`, `K0`, `K1`, `K2`, `K3`, `K4`, `KA`, `KB`, `KC`, `KD`, `KE`, `KF`, `KG`, `KH`, `KI`, `KJ`, `KK`, `KL`, `KM`, `KN`, `KO`, `KP`, `KQ`, `KR`, `KS`, `KT`, `KU`, `KV`, `KW`, `KX`, `KY`, `KZ`, `LC`, `LD`, `LL`, `LM`, `LR`, `LS`, `LT`, `LU`, `M2`, `MA`, `MB`, `MC`, `MD`, `ME`, `MF`, `MG`, `MH`, `MS`, `N1`, `N2`, `N3`, `NB`, `NR`, `NU`, `P1`, `P2`, `P3`, `P4`, `P5`, `P6`, `PA`, `PB`, `PC`, `PD`, `PI`, `PL`, `PM`, `PN`, `PO`, `PS`, `PT`, `Q0`, `Q1`, `Q2`, `Q3`, `Q4`, `Q5`, `Q6`, `Q7`, `Q8`, `Q9`, `QA`, `QB`, `QC`, `QD`, `QE`, `QF`, `QG`, `QH`, `QJ`, `QK`, `QL`, `QM`, `QN`, `QP`, `QQ`, `QR`, `QS`, `QT`, `QW`, `QX`, `QY`, `QZ`, `RA`, `RB`, `RC`, `RD`, `RE`, `RI`, `RR`, `RT`, `SA`, `SB`, `SC`, `SD`, `SE`, `SF`, `SG`, `SH`, `SJ`, `SL`, `SM`, `SN`, `SQ`, `SS`, `ST`, `SU`, `SV`, `SW`, `SY`, `T1`, `T2`, `T3`, `T4`, `T5`, `T6`, `T7`, `T8`, `T9`, `TA`, `TB`, `TC`, `TD`, `TE`, `TF`, `TG`, `TH`, `TJ`, `TK`, `TL`, `TM`, `TN`, `TP`, `TQ`, `TR`, `TS`, `TT`, `TU`, `TV`, `TW`, `U1`, `U2`, `U3`, `U4`, `U5`, `U6`, `U7`, `U8`, `U9`, `UA`, `UB`, `UC`, `UD`, `UE`, `UF`, `UG`, `UH`, `UJ`, `UK`, `UN`, `UP`, `UQ`, `UR`, `US`, `V1`, `V2`, `V3`, `W1`, `W2`, `W3`, `WC`, `WH`, `X4`, `XE`, `XP`, `XS`, `XU`, `XY`, `ZZ`
- `note` (string, optional) — Maps to NTE02 loop 2400 on the EDI 837.
- `ordering_provider` (OrderingProvider, optional) — Required when the service or supply was ordered by a provider who is different than the rendering provider for this service line. If not required by this implementation guide, do not send.
- `place_of_service_code` (enum, optional) — 837p Loop2300, SV105. This enum is not used or required in 837i claims. If your organization does not intend to submit claims with a different place of service at the service line level, this field should not be populated. 02 for telemedicine, 11 for in-person. Full list [here](https://www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `24`, `25`, `26`, `31`, `32`, `33`, `34`, `41`, `42`, `49`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `60`, `61`, `62`, `65`, `71`, `72`, `81`, `99`
- `prior_authorization_number` (string, optional) — Prior authorization number for this service line. Maps to the appropriate REF segment on Loop 2400 of the EDI 837p. This is not used for institutional claims (EDI 837i).
- `test_results` (list of TestResult, optional) — Contains a list of test results. Test result types may map to MEA-02 on the 837-P (ex: Hemoglobin, Hematocrit). This is unused by 837-i and ignored for institutional service lines. No more than 5 MEA-02 test results may be submitted per service line.

## Response

### 200

- `created_at` (datetime, required)
- `service_line_id` (UUID, required)
- `procedure_code` (string, required)
- `quantity` (string, required) — String representation of a Decimal that can be parsed by most libraries. For professional claims, a ServiceLine quantity cannot contain more than one digit of precision (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine quantity cannot contain more than three decimal digits of precision.
- `units` (enum, required)
  - Allowed values: `MJ`, `UN`
- `claim_id` (UUID, required)
- `date_of_service_range` (DateRangeOptionalEnd, required) — A range of dates of service for this service line. If the service line is for a single date, the end date will be empty.
- `date_of_service` (date, required)
- `modifiers` (list of enum, optional)
  - Allowed values: `AV`, `AU`, `AW`, `AY`, `07`, `08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `22`, `23`, `24`, `25`, `26`, `27`, `28`, `32`, `33`, `47`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `62`, `63`, `66`, `73`, `74`, `76`, `77`, `78`, `79`, `80`, `81`, `82`, `90`, `91`, `92`, `93`, `95`, `96`, `97`, `99`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, `A7`, `A8`, `A9`, `AA`, `AB`, `AD`, `AE`, `AF`, `AG`, `AH`, `AI`, `AJ`, `AK`, `AM`, `AO`, `AP`, `AQ`, `AR`, `AS`, `AT`, `AZ`, `BA`, `BL`, `BO`, `BP`, `BR`, `BU`, `CA`, `CB`, `CC`, `CD`, `CE`, `CF`, `CG`, `CH`, `CI`, `CJ`, `CK`, `CL`, `CM`, `CN`, `CR`, `CS`, `CT`, `CO`, `CQ`, `DA`, `E1`, `E2`, `E3`, `E4`, `EA`, `EB`, `EC`, `ED`, `EE`, `EJ`, `EM`, `EP`, `ER`, `ET`, `EV`, `EX`, `EY`, `F1`, `F2`, `F3`, `F4`, `F5`, `F6`, `F7`, `F8`, `F9`, `FA`, `FB`, `FC`, `FP`, `FQ`, `FR`, `FS`, `FT`, `FX`, `FY`, `G0`, `G1`, `G2`, `G3`, `G4`, `G5`, `G6`, `G7`, `G8`, `G9`, `GA`, `GB`, `GC`, `GE`, `GF`, `GG`, `GH`, `GJ`, `GK`, `GL`, `GM`, `GN`, `GO`, `GP`, `GQ`, `GR`, `GS`, `GT`, `GU`, `GV`, `GW`, `GX`, `GY`, `GZ`, `HA`, `HB`, `HC`, `HD`, `HE`, `HF`, `HG`, `HH`, `HI`, `HJ`, `HK`, `HL`, `HM`, `HN`, `HO`, `HP`, `HQ`, `HR`, `HS`, `HT`, `HU`, `HV`, `HW`, `HX`, `HY`, `HZ`, `J1`, `J2`, `J3`, `J4`, `J5`, `JA`, `JB`, `JC`, `JD`, `JE`, `JG`, `JW`, `JZ`, `K0`, `K1`, `K2`, `K3`, `K4`, `KA`, `KB`, `KC`, `KD`, `KE`, `KF`, `KG`, `KH`, `KI`, `KJ`, `KK`, `KL`, `KM`, `KN`, `KO`, `KP`, `KQ`, `KR`, `KS`, `KT`, `KU`, `KV`, `KW`, `KX`, `KY`, `KZ`, `LC`, `LD`, `LL`, `LM`, `LR`, `LS`, `LT`, `LU`, `M2`, `MA`, `MB`, `MC`, `MD`, `ME`, `MF`, `MG`, `MH`, `MS`, `N1`, `N2`, `N3`, `NB`, `NR`, `NU`, `P1`, `P2`, `P3`, `P4`, `P5`, `P6`, `PA`, `PB`, `PC`, `PD`, `PI`, `PL`, `PM`, `PN`, `PO`, `PS`, `PT`, `Q0`, `Q1`, `Q2`, `Q3`, `Q4`, `Q5`, `Q6`, `Q7`, `Q8`, `Q9`, `QA`, `QB`, `QC`, `QD`, `QE`, `QF`, `QG`, `QH`, `QJ`, `QK`, `QL`, `QM`, `QN`, `QP`, `QQ`, `QR`, `QS`, `QT`, `QW`, `QX`, `QY`, `QZ`, `RA`, `RB`, `RC`, `RD`, `RE`, `RI`, `RR`, `RT`, `SA`, `SB`, `SC`, `SD`, `SE`, `SF`, `SG`, `SH`, `SJ`, `SL`, `SM`, `SN`, `SQ`, `SS`, `ST`, `SU`, `SV`, `SW`, `SY`, `T1`, `T2`, `T3`, `T4`, `T5`, `T6`, `T7`, `T8`, `T9`, `TA`, `TB`, `TC`, `TD`, `TE`, `TF`, `TG`, `TH`, `TJ`, `TK`, `TL`, `TM`, `TN`, `TP`, `TQ`, `TR`, `TS`, `TT`, `TU`, `TV`, `TW`, `U1`, `U2`, `U3`, `U4`, `U5`, `U6`, `U7`, `U8`, `U9`, `UA`, `UB`, `UC`, `UD`, `UE`, `UF`, `UG`, `UH`, `UJ`, `UK`, `UN`, `UP`, `UQ`, `UR`, `US`, `V1`, `V2`, `V3`, `W1`, `W2`, `W3`, `WC`, `WH`, `X4`, `XE`, `XP`, `XS`, `XU`, `XY`, `ZZ`
- `charge_amount_cents` (integer, optional)
- `allowed_amount_cents` (integer, optional)
- `insurance_balance_cents` (integer, optional)
- `patient_balance_cents` (integer, optional)
- `paid_amount_cents` (integer, optional)
- `primary_paid_amount_cents` (integer, optional)
- `secondary_paid_amount_cents` (integer, optional)
- `tertiary_paid_amount_cents` (integer, optional)
- `patient_responsibility_cents` (integer, optional)
- `copay_cents` (integer, optional)
- `coinsurance_cents` (integer, optional)
- `deductible_cents` (integer, optional)
- `diagnosis_id_zero` (UUID, optional)
- `diagnosis_id_one` (UUID, optional)
- `diagnosis_id_two` (UUID, optional)
- `diagnosis_id_three` (UUID, optional)
- `drug_identification` (DrugIdentification, optional)
- `service_line_era_data` (ServiceLineERAData, optional)
- `service_line_manual_adjustments` (list of ServiceLineAdjustment, optional)
- `related_invoices` (list of Invoice, optional)
- `related_invoice_info` (list of InvoiceInfo, optional)
- `denial_reason` (ServiceLineDenialReason, optional) — The reason a given service line was denied within a given time range. A service line may be denied for different reasons over time, but only one reason at a time.
- `place_of_service_code` (enum, optional) — 837p Loop2300, SV105. This enum is not used or required in 837i claims. If your organization does not intend to submit claims with a different place of service at the service line level, this field should not be populated. 02 for telemedicine, 11 for in-person. Full list [here](https://www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `24`, `25`, `26`, `31`, `32`, `33`, `34`, `41`, `42`, `49`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `60`, `61`, `62`, `65`, `71`, `72`, `81`, `99`
- `place_of_service_code_as_submitted` (enum, optional) — 837p Loop2300, SV105. 02 for telemedicine, 11 for in-person. Full list [here](https://www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
  - Allowed values: `01`, `02`, `03`, `04`, `05`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `24`, `25`, `26`, `31`, `32`, `33`, `34`, `41`, `42`, `49`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `60`, `61`, `62`, `65`, `71`, `72`, `81`, `99`
- `custom_procedure_code` (string, optional) — Represents and preserves the custom CPT code received on this service line. Custom CPT codes are specific to your organization and are used for rules and reporting purposes.
- `ordering_provider` (EncounterProvider, optional)
- `revenue_code` (string, optional) — A 4 digit code that specifies facility department or type of service arrangement for institutional service line items (837i). This code is not required for professional claim billing (837p).
- `description` (string, optional) — A free-form description to clarify the related data elements and their content. Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
- `end_date_of_service` (date, optional)
- `test_results` (list of TestResult, optional) — Contains a list of test results. Test result types may map to MEA-02 on the 837-P (ex: Hemoglobin, Hematocrit). This is unused by 837-i and ignored for institutional service lines. No more than 5 MEA-02 test results may be submitted per service line.
- `has_epsdt_indicator` (boolean, optional) — Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500. If the value is true, the box will be populated with "Y". Otherwise, the box will not be populated.
- `has_family_planning_indicator` (boolean, optional) — Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500. If the value is true, the box will be populated with "Y". Otherwise, the box will not be populated.
- `note` (string, optional) — Maps to NTE02 loop 2400 on the EDI 837.
- `prior_authorization_number` (string, optional) — Prior authorization number for this service line. Maps to the appropriate REF segment on Loop 2400 of the EDI 837p. This is not used for institutional claims (EDI 837i).
- `external_id` (string, optional) — An external identifier for this service line. This is not used in the EDI 837, but can be used to identify the service line in external systems. This field should not contain PHI. Must be unique on a given claim.

## Errors

### 409 Entity Conflict Error

- `errorName` ("EntityConflictError", required)
- `content` (EntityConflictErrorMessage, required)

### 422 HTTP Request Validation Error

- `errorName` ("HttpRequestValidationError", required)
- `content` (RequestValidationError, required)

## Types

### ServiceLineDenialReason

The reason a given service line was denied within a given time range. A service line may be denied for different reasons over time, but only one reason at a time.

- `reason` (enum, optional) — Text of the denial reason
  - Allowed values: `Authorization Required`, `Referral Required`, `Medical Records Requested`, `Timely Filing`, `Duplicate Claim`, `Full Contractual Adjustment`, `Incorrect Place of Service`, `Incorrect Patient Gender`, `Incorrect Patient Info`, `Bundled`, `Exceeded Billable Time`, `Invalid Provider Information`, `Invalid Diagnosis Code`, `Incorrect Procedure Code`, `Invalid Modifier`, `Missing NDC Code`, `Invalid Insurance Data`, `No Active Coverage`, `Coordination of Benefits`, `Incorrect Payer`, `Credentialing`, `No Effective Contract`, `Missing W-9`, `Missing Contract Linkage`, `Non-Covered Benefit`, `Experimental Procedure`, `Not Medically Necessary`, `Info Requested from Provider`, `Info Requested from Patient`, `Billing Error`, `Unknown`, `Max Benefit Reached`

### DrugIdentification

- `service_id_qualifier` (enum, required)
  - Allowed values: `EN`, `EO`, `HI`, `N4`, `ON`, `UK`, `UP`
- `national_drug_code` (string, required)
- `national_drug_unit_count` (string, required)
- `measurement_unit_code` (enum, required)
  - Allowed values: `ML`, `UN`, `GR`, `F2`, `ME`
- `link_sequence_number` (string, optional)
- `pharmacy_prescription_number` (string, optional)
- `conversion_formula` (string, optional)
- `drug_description` (string, optional)

### OrderingProvider

- `npi` (string, required) — A National Provider Identifier is a unique 10-digit identification number issued to health care providers in the United States
- `address` (StreetAddressLongZip, optional)
- `first_name` (string, optional) — If the provider is an individual, this should be set instead of organization name
- `last_name` (string, optional) — If the provider is an individual, this should be set instead of organization name
- `organization_name` (string, optional) — If the provider is an organization, this should be set instead of first + last name
- `taxonomy_code` (string, optional)

### TestResult

- `value` (double, required)
- `result_type` (enum, required)
  - Allowed values: `HEMATOCRIT`, `HEMOGLOBIN`, `LDL`, `VITAMIN_D`

### DateRangeOptionalEnd

- `start_date` (string, required) — ISO 8601 date; formatted YYYY-MM-DD (i.e. 2012-02-01)
- `end_date` (string, optional) — ISO 8601 date; formatted YYYY-MM-DD (i.e. 2012-02-01)

### ServiceLineERAData

- `remittance_advice_remark_codes` (list of string, required)
- `service_line_adjustments` (list of ServiceLineAdjustment, required, deprecated) — Deprecated. This field aggregates all CARCs across a service line's history without granular context (e.g., which CARCs relate to denials vs. payments vs. reversals), making it unsuitable for denial analysis or operational workflows.

### ServiceLineAdjustment

- `created_at` (datetime, required)
- `adjustment_group_code` (string, optional)
- `adjustment_reason_code` (string, optional)
- `adjustment_amount_cents` (integer, optional)
- `adjustment_note` (string, optional)

### Invoice

- `id` (UUID, required)
- `created_at` (datetime, required)
- `updated_at` (datetime, required)
- `organzation_id` (UUID, required)
- `source_id` (string, required)
- `source_customer_id` (string, required)
- `patient_external_id` (string, required)
- `due_date` (string, required) — ISO 8601 date; formatted YYYY-MM-DD (i.e. 2012-02-01)
- `status` (enum, required)
  - Allowed values: `draft`, `open`, `paid`, `void`, `uncollectible`, `held`
- `items` (list of InvoiceItem, required)
- `note` (string, optional)
- `url` (string, optional)
- `customer_invoice_url` (string, optional)

### InvoiceInfo

- `id` (UUID, required)
- `invoice` (Invoice, required)
- `invoice_type` (enum, required)
  - Allowed values: `STRIPE`, `CEDAR`, `HEALTHIE`, `COLLECTLY`, `THIRD_PARTY_PAYERS`, `INSTAMED`, `REVSPRING`

### EncounterProvider

- `address` (StreetAddressLongZip, required)
- `npi` (string, required)
- `provider_id` (UUID, required)
- `first_name` (string, optional) — If the provider is an individual, this should be set instead of organization name
- `last_name` (string, optional) — If the provider is an individual, this should be set instead of organization name
- `organization_name` (string, optional) — If the provider is an organization, this should be set instead of first + last name
- `provider_commercial_license_type` (enum, optional) — 837i Loop2010BB G2 Provider Commercial Number
  - Allowed values: `0`, `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H`, `I`
- `qualifier` (enum, optional)
  - Allowed values: `DQ`, `DN`, `DK`, `P3`
- `secondary_identification` (ProviderSecondaryIdentification, optional) — Only one of provider_commercial_license_type or secondary_identification may be provided 837i Loop2010BB G2 Secondary Identification
- `tax_id` (string, optional)
- `taxonomy_code` (string, optional)

### EntityConflictErrorMessage

- `entity_name` (string, required)

### RequestValidationError

- `fieldName` (string, required)
- `humanReadableMessage` (string, optional)

### StreetAddressLongZip

- `address1` (string, required)
- `city` (string, required)
- `state` (enum, required)
  - Allowed values: `AA`, `AE`, `AP`, `AL`, `AK`, `AS`, `AZ`, `AR`, `CA`, `CO`, `CT`, `DC`, `DE`, `FL`, `FM`, `GA`, `GU`, `HI`, `ID`, `IL`, `IN`, `IA`, `KS`, `KY`, `LA`, `ME`, `MD`, `MA`, `MH`, `MI`, `MN`, `MP`, `MS`, `MO`, `MT`, `NE`, `NV`, `NH`, `NJ`, `NM`, `NY`, `NC`, `ND`, `OH`, `OK`, `OR`, `PA`, `PR`, `PW`, `RI`, `SC`, `SD`, `TN`, `TX`, `UT`, `VI`, `VT`, `VA`, `WA`, `WV`, `WI`, `WY`, `FC`
- `zip_code` (string, required) — 5-digit zip code
- `zip_plus_four_code` (string, required) — 4-digit zip add-on code https://en.wikipedia.org/wiki/ZIP_Code#ZIP+4
- `address2` (string, optional)

### InvoiceItem

- `service_line_id` (UUID, required)
- `amount_cents` (integer, required)

### Invoice

- `amount_cents` (integer, required) — Total monetary amount (in cents) of all Invoice Items
- `created_at` (datetime, required)
- `updated_at` (datetime, required)
- `organization_id` (UUID, required)
- `invoice_destination_metadata` (InvoiceDestinationMetadata, required) — Contains all relevant information from the third-party service this invoice was created in
- `patient_external_id` (string, required)
- `due_date` (date, required)
- `status` (enum, required)
  - Allowed values: `DRAFT`, `OPEN`, `PAID`, `VOID`, `UNCOLLECTIBLE`, `HELD`
- `items` (InvoiceItemInfo, required) — The InvoiceItem rollup which contains all claim and service line invoice items
- `note` (string, optional)
- `url` (string, optional) — Link to the admin view of the invoice in the third-party service
- `customer_invoice_url` (string, optional) — Link to the patient view of the invoice in the third-party service

### ProviderSecondaryIdentification

- `reference_identification` (string, required) — Represents REF02 on the EDI 837 Loop 2010BB Billing Provider Secondary Identification segment. Value cannot exceed 50 characters
- `reference_identification_qualifier` (enum, optional) — Represents REF01 on the EDI 837 Loop 2010BB Provider Secondary Identification segment.
  - Allowed values: `0B`, `1G`, `G2`, `LU`

### InvoiceDestinationMetadata

- `invoice_destination` (enum, required) — Defines which third-party service this invoice was created in
  - Allowed values: `STRIPE`, `CEDAR`, `HEALTHIE`, `COLLECTLY`, `THIRD_PARTY_PAYERS`, `INSTAMED`, `REVSPRING`
- `source_id` (string, required) — The id of the invoice in the third-party service
- `source_customer_id` (string, required) — The id of the customer that the invoice is attributed to in the third-party service
- `destination_status` (string, optional) — The status of the invoice in the third-party service

### InvoiceItemInfo

- `claim_invoice_items` (map from UUID to ClaimInvoiceItemInfo, required)
- `unattributed_items` (list of UnattributedInvoiceItem, required)

### ClaimInvoiceItemInfo

- `service_line_invoice_items` (map from UUID to ServiceLineInvoiceItem, required)
- `claim_invoice_item` (ClaimInvoiceItem, optional)

### UnattributedInvoiceItem

- `amount_cents` (integer, required)

### ServiceLineInvoiceItem

- `service_line_id` (UUID, required)
- `amount_cents` (integer, required)

### ClaimInvoiceItem

- `claim_id` (UUID, required)
- `amount_cents` (integer, required)

## Examples

**Request**

```json
{
  "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "procedure_code": "procedure_code",
  "quantity": "quantity",
  "units": "MJ"
}
```

**Response**

```json
{
  "created_at": "2024-01-15T09:30:00Z",
  "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "procedure_code": "procedure_code",
  "quantity": "quantity",
  "units": "MJ",
  "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "date_of_service_range": {
    "start_date": "start_date",
    "end_date": "end_date"
  },
  "date_of_service": "2023-01-15",
  "modifiers": [
    "AV",
    "AV"
  ],
  "charge_amount_cents": 1,
  "allowed_amount_cents": 1,
  "insurance_balance_cents": 1,
  "patient_balance_cents": 1,
  "paid_amount_cents": 1,
  "primary_paid_amount_cents": 1,
  "secondary_paid_amount_cents": 1,
  "tertiary_paid_amount_cents": 1,
  "patient_responsibility_cents": 1,
  "copay_cents": 1,
  "coinsurance_cents": 1,
  "deductible_cents": 1,
  "diagnosis_id_zero": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "diagnosis_id_one": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "diagnosis_id_two": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "diagnosis_id_three": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "drug_identification": {
    "service_id_qualifier": "EN",
    "national_drug_code": "national_drug_code",
    "national_drug_unit_count": "national_drug_unit_count",
    "measurement_unit_code": "ML",
    "link_sequence_number": "link_sequence_number",
    "pharmacy_prescription_number": "pharmacy_prescription_number",
    "conversion_formula": "conversion_formula",
    "drug_description": "drug_description"
  },
  "service_line_era_data": {
    "remittance_advice_remark_codes": [
      "remittance_advice_remark_codes",
      "remittance_advice_remark_codes"
    ],
    "service_line_adjustments": [
      {
        "created_at": "2024-01-15T09:30:00Z",
        "adjustment_group_code": "adjustment_group_code",
        "adjustment_reason_code": "adjustment_reason_code",
        "adjustment_amount_cents": 1,
        "adjustment_note": "adjustment_note"
      },
      {
        "created_at": "2024-01-15T09:30:00Z",
        "adjustment_group_code": "adjustment_group_code",
        "adjustment_reason_code": "adjustment_reason_code",
        "adjustment_amount_cents": 1,
        "adjustment_note": "adjustment_note"
      }
    ]
  },
  "service_line_manual_adjustments": [
    {
      "created_at": "2024-01-15T09:30:00Z",
      "adjustment_group_code": "adjustment_group_code",
      "adjustment_reason_code": "adjustment_reason_code",
      "adjustment_amount_cents": 1,
      "adjustment_note": "adjustment_note"
    },
    {
      "created_at": "2024-01-15T09:30:00Z",
      "adjustment_group_code": "adjustment_group_code",
      "adjustment_reason_code": "adjustment_reason_code",
      "adjustment_amount_cents": 1,
      "adjustment_note": "adjustment_note"
    }
  ],
  "related_invoices": [
    {
      "id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "organzation_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
      "source_id": "source_id",
      "source_customer_id": "source_customer_id",
      "patient_external_id": "patient_external_id",
      "due_date": "due_date",
      "status": "draft",
      "items": [
        {
          "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
          "amount_cents": 1
        },
        {
          "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
          "amount_cents": 1
        }
      ],
      "note": "note",
      "url": "url",
      "customer_invoice_url": "customer_invoice_url"
    },
    {
      "id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "organzation_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
      "source_id": "source_id",
      "source_customer_id": "source_customer_id",
      "patient_external_id": "patient_external_id",
      "due_date": "due_date",
      "status": "draft",
      "items": [
        {
          "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
          "amount_cents": 1
        },
        {
          "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
          "amount_cents": 1
        }
      ],
      "note": "note",
      "url": "url",
      "customer_invoice_url": "customer_invoice_url"
    }
  ],
  "related_invoice_info": [
    {
      "id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
      "invoice": {
        "amount_cents": 1,
        "created_at": "2024-01-15T09:30:00Z",
        "updated_at": "2024-01-15T09:30:00Z",
        "organization_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
        "invoice_destination_metadata": {
          "invoice_destination": "STRIPE",
          "source_id": "source_id",
          "source_customer_id": "source_customer_id",
          "destination_status": "destination_status"
        },
        "patient_external_id": "patient_external_id",
        "due_date": "2023-01-15",
        "status": "DRAFT",
        "items": {
          "claim_invoice_items": {
            "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": {
              "service_line_invoice_items": {
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": {
                  "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                  "amount_cents": 1
                }
              },
              "claim_invoice_item": {
                "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                "amount_cents": 1
              }
            }
          },
          "unattributed_items": [
            {
              "amount_cents": 1
            },
            {
              "amount_cents": 1
            }
          ]
        },
        "note": "note",
        "url": "url",
        "customer_invoice_url": "customer_invoice_url"
      },
      "invoice_type": "STRIPE"
    },
    {
      "id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
      "invoice": {
        "amount_cents": 1,
        "created_at": "2024-01-15T09:30:00Z",
        "updated_at": "2024-01-15T09:30:00Z",
        "organization_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
        "invoice_destination_metadata": {
          "invoice_destination": "STRIPE",
          "source_id": "source_id",
          "source_customer_id": "source_customer_id",
          "destination_status": "destination_status"
        },
        "patient_external_id": "patient_external_id",
        "due_date": "2023-01-15",
        "status": "DRAFT",
        "items": {
          "claim_invoice_items": {
            "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": {
              "service_line_invoice_items": {
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32": {
                  "service_line_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                  "amount_cents": 1
                }
              },
              "claim_invoice_item": {
                "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                "amount_cents": 1
              }
            }
          },
          "unattributed_items": [
            {
              "amount_cents": 1
            },
            {
              "amount_cents": 1
            }
          ]
        },
        "note": "note",
        "url": "url",
        "customer_invoice_url": "customer_invoice_url"
      },
      "invoice_type": "STRIPE"
    }
  ],
  "denial_reason": {
    "reason": "Authorization Required"
  },
  "place_of_service_code": "01",
  "place_of_service_code_as_submitted": "01",
  "custom_procedure_code": "custom_procedure_code",
  "ordering_provider": {
    "address": {
      "address1": "address1",
      "city": "city",
      "state": "AA",
      "zip_code": "zip_code",
      "zip_plus_four_code": "zip_plus_four_code",
      "address2": "address2"
    },
    "npi": "npi",
    "provider_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
    "first_name": "first_name",
    "last_name": "last_name",
    "organization_name": "organization_name",
    "provider_commercial_license_type": "0",
    "qualifier": "DQ",
    "secondary_identification": {
      "reference_identification": "reference_identification",
      "reference_identification_qualifier": "0B"
    },
    "tax_id": "tax_id",
    "taxonomy_code": "taxonomy_code"
  },
  "revenue_code": "revenue_code",
  "description": "description",
  "end_date_of_service": "2023-01-15",
  "test_results": [
    {
      "value": 1.1,
      "result_type": "HEMATOCRIT"
    },
    {
      "value": 1.1,
      "result_type": "HEMATOCRIT"
    }
  ],
  "has_epsdt_indicator": true,
  "has_family_planning_indicator": true,
  "note": "note",
  "prior_authorization_number": "prior_authorization_number",
  "external_id": "external_id"
}
```

**SDK Code**

```python
import requests

url = "https://api.joincandidhealth.com/api/service-lines/v2"

payload = {
    "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
    "procedure_code": "procedure_code",
    "quantity": "quantity",
    "units": "MJ"
}
headers = {
    "Authorization": "<token>.",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.joincandidhealth.com/api/service-lines/v2';
const options = {
  method: 'POST',
  headers: {Authorization: '<token>.', 'Content-Type': 'application/json'},
  body: '{"claim_id":"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32","procedure_code":"procedure_code","quantity":"quantity","units":"MJ"}'
};

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.joincandidhealth.com/api/service-lines/v2"

	payload := strings.NewReader("{\n  \"claim_id\": \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n  \"procedure_code\": \"procedure_code\",\n  \"quantity\": \"quantity\",\n  \"units\": \"MJ\"\n}")

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

	req.Header.Add("Authorization", "<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.joincandidhealth.com/api/service-lines/v2")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<token>.'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"claim_id\": \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n  \"procedure_code\": \"procedure_code\",\n  \"quantity\": \"quantity\",\n  \"units\": \"MJ\"\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.joincandidhealth.com/api/service-lines/v2")
  .header("Authorization", "<token>.")
  .header("Content-Type", "application/json")
  .body("{\n  \"claim_id\": \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n  \"procedure_code\": \"procedure_code\",\n  \"quantity\": \"quantity\",\n  \"units\": \"MJ\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.joincandidhealth.com/api/service-lines/v2', [
  'body' => '{
  "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "procedure_code": "procedure_code",
  "quantity": "quantity",
  "units": "MJ"
}',
  'headers' => [
    'Authorization' => '<token>.',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.joincandidhealth.com/api/service-lines/v2");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<token>.");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"claim_id\": \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n  \"procedure_code\": \"procedure_code\",\n  \"quantity\": \"quantity\",\n  \"units\": \"MJ\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<token>.",
  "Content-Type": "application/json"
]
let parameters = [
  "claim_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "procedure_code": "procedure_code",
  "quantity": "quantity",
  "units": "MJ"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.joincandidhealth.com/api/service-lines/v2")! 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()
```