> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thrivory.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Integrate ThriveNow — authenticate, review a claim, create terms, confirm funding, and receive webhooks.

# Quickstart

This guide gets you from zero to a working integration with the **ThriveNow API**: obtain an access token, **review** a claim to get predictions and an `authorization_id`, **adjudicate** to create terms, **confirm** funding, and receive **webhooks** for status and reconciliation.

> **Prerequisites**
>
> * A **Business Associate Agreement (BAA)** with Thrivory for production use.
> * **Sandbox credentials** (OAuth 2.0 Client Credentials).
> * A publicly reachable **HTTPS** endpoint for webhooks.
> * Minimal‑PHI integration: send only fields required for prediction/settlement.

***

## 1) Configure your environment

```bash theme={null}
export THRIVORY_BASE_URL="https://api.sandbox.thrivory.com" # or production URL after approval
export THRIVORY_CLIENT_ID="<your-client-id>"
export THRIVORY_CLIENT_SECRET="<your-client-secret>"
export THRIVORY_TOKEN_FILE="./thrivory_token.json"
```

***

## 2) Get an access token (OAuth 2.0 Client Credentials)

```bash theme={null}
curl -s -X POST "$THRIVORY_BASE_URL/v1/oauth/token"   -H "Content-Type: application/json"   -d '{
    "client_id": "'"$THRIVORY_CLIENT_ID"'",
    "client_secret": "'"$THRIVORY_CLIENT_SECRET"'",
    "grant_type": "client_credentials"
  }' | tee "$THRIVORY_TOKEN_FILE"
```

```bash theme={null}
export THRIVORY_ACCESS_TOKEN="$(jq -r .access_token < "$THRIVORY_TOKEN_FILE")"
```

***

## 3) (Optional) Look up a payer (Thrivory IDs available upon request)

```bash theme={null}
curl -s "$THRIVORY_BASE_URL/v1/metadata/payers?q=Aetna&system=internal"   -H "Authorization: Bearer $THRIVORY_ACCESS_TOKEN"
```

Use the returned **Thrivory Payer ID** as `patient_primary_payor_id`.

***

## 4) Review a claim (predictions + authorization\_id)

```bash theme={null}
curl -s -X POST "$THRIVORY_BASE_URL/v1/claims/reviews"   -H "Authorization: Bearer $THRIVORY_ACCESS_TOKEN"   -H "Content-Type: application/json"   -H "Idempotency-Key: demo-claim-001"   -d '{
    "facility": "ABC",
    "claim_identifier": "CLM-10001",
    "chart_identifier": "PAT-5678",
    "date_of_service": "2025-08-15",
    "date_of_submission": "2025-08-16",
    "servicer_npi": "1111111111",
    "billing_npi": "5556667778",
    "patient_primary_payor_id": "thrivoryid:123456",
    "submitted_amount": 5000,
    "service_lines": [
      { "cpt": "J1745", "modifier": "JW", "units": 1, "amount": 5000 }
    ]
  }'
```

**Example response**

```json theme={null}
{
  "id": "rvw_123",
  "authorization_id": "auth_abc123",
  "denial_predicted": false,
  "denial_reasons": [],
  "expected_reimbursement": { "allowed": 4800, "expected": 4800 },
  "expected_payment_date": "2025-09-29",
  "confidence": 0.91
}
```

> Use `authorization_id` in the next step to create adjudication terms.

***

## 5) Create adjudication terms (funding options)

```bash theme={null}
curl -s -X POST "$THRIVORY_BASE_URL/v1/claims/adjudications"   -H "Authorization: Bearer $THRIVORY_ACCESS_TOKEN"   -H "Content-Type: application/json"   -H "Idempotency-Key: demo-adj-001"   -d '{
    "authorization_id": "auth_abc123",
    "funding": { "rail": "SAME_DAY" },
    "payout_account_token": "bank_tok_abc123"
  }'
```

**Example response**

```json theme={null}
{
  "settlement_id": "stl_987654321",
  "decision": "approved",
  "terms": {
    "advance_percentage": 0.80,
    "advance_amount": 3840,
    "fees_estimate": 96
  },
  "status": "pending_confirmation",
  "expected_reimbursement": 4800,
  "expected_payment_date": "2025-09-29"
}
```

***

## 6) Confirm funding

```bash theme={null}
curl -s -X POST "$THRIVORY_BASE_URL/v1/settlements/stl_987654321/confirm"   -H "Authorization: Bearer $THRIVORY_ACCESS_TOKEN"   -H "Idempotency-Key: demo-confirm-001"
```

**Example response**

```json theme={null}
{
  "settlement_id": "stl_987654321",
  "status": "funded",
  "funded_amount": 3840,
  "timestamp": "2025-09-09T14:32:00Z"
}
```

***

## 7) Subscribe to webhooks

Configure your endpoint to verify the **Thrivory-Signature** (HMAC SHA-256) header. Webhook payloads use a common envelope.

**Example — `reconciliation.posted`**

```json theme={null}
{
  "event": "reconciliation.posted",
  "id": "evt_12345",
  "created_at": "2025-09-30T12:01:22Z",
  "data": {
    "id": "rcn_001",
    "settlement_id": "stl_987654321",
    "payer_payment": 4800,
    "fee_collected": 96,
    "final_status": "closed"
  }
}
```

***

## Go-live checklist

* BAA executed + security review complete
* Least‑privilege OAuth client + key rotation policy
* Webhook signature verification with retries/backoff
* Logging/audit for PHI access and operational events
* Idempotent POSTs with `Idempotency-Key`

***

## Troubleshooting

* **400 – Validation error**: Check required fields (`claim_identifier`, `chart_identifier`, `servicer_npi`, `billing_npi`, `patient_primary_payor_id`, `submitted_amount`).
* **401 – Unauthorized**: Token expired/invalid. Refresh credentials.
* **404 – Not found**: Invalid `settlement_id` or `claim_id`.
* **500 – Server error**: Transient. Retry with backoff (idempotent).

***

## Support

Need sandbox credentials or a BAA template?\
**Email:** [support@thrivory.com](mailto:support@thrivory.com)

***

*Last updated: 2025-09-11 21:22 UTC*
