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

# Flows Quickstart

This guide creates a Flow template that runs a Verification, then starts and checks one Run in the sandbox. You need a sandbox access token from the [API Quickstart](https://docs.soharhealth.com/documentation/getting-started/quickstart.md).

## 1. Create a Flow

Call [Create Flow](https://docs.soharhealth.com/api-reference/flows/create-flow.md) with a name and description. Save the `flowId` from the response.

```bash theme={null}
curl -X POST https://api.soharhealth.com/v1/flows \
  -H "Authorization: Bearer $SOHAR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Verification quickstart","description":"Run one Verification and return its status"}'
```

## 2. Publish a template

Save this YAML as `verification-flow.yml`. Its input matches the Verification request used in the API Quickstart.

```yaml theme={null}
input:
  type: object
  required:
    - patient
    - payerId
    - placeOfServiceCode
    - specialtyCode
  properties:
    patient:
      type: object
      required:
        - firstName
        - lastName
        - dateOfBirth
        - state
        - memberId
      properties:
        firstName:
          type: string
        lastName:
          type: string
        dateOfBirth:
          type: string
        state:
          type: string
        memberId:
          type: string
    payerId:
      type: string
    placeOfServiceCode:
      type: string
    specialtyCode:
      type: string

startsAt: verification
states:
  verification:
    type: request
    resource: Verification
    resultSelector:
      type: object
      properties:
        verificationStatus:
          type: string
          value: $response.status
    next: final
  final:
    end: true

output:
  type: object
  properties:
    verificationStatus:
      type: string
      value: $.verificationStatus
```

Publish it as the Flow's first version with [Create Flow Template](https://docs.soharhealth.com/api-reference/flows/create-flow-template.md):

```bash theme={null}
curl -X POST "https://api.soharhealth.com/v1/flows/$FLOW_ID/templates" \
  -H "Authorization: Bearer $SOHAR_ACCESS_TOKEN" \
  -H "Content-Type: application/x-yaml" \
  --data-binary @verification-flow.yml
```

## 3. Start a Run

Use the sandbox patient values from the [API Quickstart](https://docs.soharhealth.com/documentation/getting-started/quickstart.md). Save the returned `flowRunId`.

```bash theme={null}
curl -X POST "https://api.soharhealth.com/v1/runs" \
  -H "Authorization: Bearer $SOHAR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "flowId": "'"$FLOW_ID"'",
    "input": {
      "patient": {
        "firstName": "John",
        "lastName": "Doe",
        "dateOfBirth": "09/20/2006",
        "state": "CA",
        "memberId": "00000000"
      },
      "payerId": "60054",
      "placeOfServiceCode": "10",
      "specialtyCode": "PSY"
    }
  }'
```

## 4. Check the result

Runs are asynchronous. Call [Get Run](https://docs.soharhealth.com/api-reference/runs/get-run.md) with the `flowRunId` until its status is `COMPLETE` or `ERROR`. On `COMPLETE`, read `output.verificationStatus` from the response.

```bash theme={null}
curl "https://api.soharhealth.com/v1/runs/$FLOW_RUN_ID" \
  -H "Authorization: Bearer $SOHAR_ACCESS_TOKEN"
```

For branching, callbacks, and parallel steps, continue with [Building Flows](https://docs.soharhealth.com/documentation/flows/building-flows.md) and [Using Flows](https://docs.soharhealth.com/documentation/flows/using-flows.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.