# Tracks
URL: https://docs.awellhealth.com/api-reference/reference/tracks

> For the complete documentation index, see [llms.txt](https://docs.awellhealth.com/llms.txt).



Query and schedule tracks — the groupings of steps within a care flow.

## Queries [#queries]

### `adHocTracksByPathway` [#adhoctracksbypathway]

Returns the ad hoc tracks that can be triggered for a care flow.

**Arguments**

| Argument     | Type      | Required | Description             |
| ------------ | --------- | -------- | ----------------------- |
| `pathway_id` | `String!` | Yes      | The ID of the care flow |

**Returns:** `TracksPayload!`

**Example**

```graphql
query AdHocTracksByPathway($pathway_id: String!) {
  adHocTracksByPathway(pathway_id: $pathway_id) {
    code
    success
    tracks {
      can_trigger_manually
      id
      release_id
      title
    }
  }
}
```

Variables:

```json
{
  "pathway_id": "<string>"
}
```

### `adHocTracksByRelease` [#adhoctracksbyrelease]

Returns the ad hoc tracks available in a published care flow definition version (release).

**Arguments**

| Argument     | Type      | Required | Description                                                    |
| ------------ | --------- | -------- | -------------------------------------------------------------- |
| `release_id` | `String!` | Yes      | The ID of the published care flow definition version (release) |

**Returns:** `TracksPayload!`

**Example**

```graphql
query AdHocTracksByRelease($release_id: String!) {
  adHocTracksByRelease(release_id: $release_id) {
    code
    success
    tracks {
      can_trigger_manually
      id
      release_id
      title
    }
  }
}
```

Variables:

```json
{
  "release_id": "<string>"
}
```

### `careflowTracks` [#careflowtracks]

Returns the tracks in a care flow, optionally filtered by status.

**Arguments**

| Argument      | Type        | Required | Description                     |
| ------------- | ----------- | -------- | ------------------------------- |
| `careflow_id` | `String!`   | Yes      | The ID of the care flow         |
| `statuses`    | `[String!]` | No       | The track statuses to filter by |

**Returns:** `CareflowTracksPayload!`

**Example**

```graphql
query CareflowTracks($careflow_id: String!, $statuses: [String!]) {
  careflowTracks(careflow_id: $careflow_id, statuses: $statuses) {
    code
    success
    tracks {
      definition_id
      end_date
      id
      start_date
      started_by_user_id
      started_by_user_name
      status
      stop_reason
      stopped_by_user_id
      stopped_by_user_name
      title
    }
  }
}
```

Variables:

```json
{
  "careflow_id": "<string>",
  "statuses": [
    "<string>"
  ]
}
```

### `scheduledDestinations` [#scheduleddestinations]

Returns the scheduled destinations for a care flow.

**Arguments**

| Argument     | Type      | Required | Description             |
| ------------ | --------- | -------- | ----------------------- |
| `pathway_id` | `String!` | Yes      | The ID of the care flow |

**Returns:** `ScheduledDestinationsPayload!`

**Example**

```graphql
query ScheduledDestinations($pathway_id: String!) {
  scheduledDestinations(pathway_id: $pathway_id) {
    code
    destinations {
      date
      node {
        date
        definition_id
        definition_type
        id
        name
        track_definition_id
      }
    }
    success
  }
}
```

Variables:

```json
{
  "pathway_id": "<string>"
}
```

### `scheduledSteps` [#scheduledsteps]

Returns the scheduled steps for a care flow.

**Arguments**

| Argument     | Type      | Required | Description             |
| ------------ | --------- | -------- | ----------------------- |
| `pathway_id` | `String!` | Yes      | The ID of the care flow |

**Returns:** `ScheduledStepsPayload!`

**Example**

```graphql
query ScheduledSteps($pathway_id: String!) {
  scheduledSteps(pathway_id: $pathway_id) {
    code
    steps {
      activity_type
      context {
        action_id
        agent_config_id
        agent_id
        agent_thread_id
        instance_id
        pathway_id
        run_id
        step_id
        track_id
      }
      definition_id
      end_date
      id
      label {
        color
        id
        text
      }
      name
      parent_id
      stakeholders {
        id
        name
      }
      start_date
      status
      type
    }
    success
  }
}
```

Variables:

```json
{
  "pathway_id": "<string>"
}
```

### `scheduledTracksForPathway` [#scheduledtracksforpathway]

Returns the scheduled tracks for a care flow.

**Arguments**

| Argument     | Type      | Required | Description             |
| ------------ | --------- | -------- | ----------------------- |
| `pathway_id` | `String!` | Yes      | The ID of the care flow |

**Returns:** `ScheduledTracksPayload!`

**Example**

```graphql
query ScheduledTracksForPathway($pathway_id: String!) {
  scheduledTracksForPathway(pathway_id: $pathway_id) {
    code
    scheduled_tracks {
      created_by_user_id
      created_date
      id
      modified_date
      pathway_id
      release_id
      scheduled_date
      status
      tenant_id
      title
      track_definition_id
    }
    success
  }
}
```

Variables:

```json
{
  "pathway_id": "<string>"
}
```

### `tracksByPathway` [#tracksbypathway]

Returns the tracks in a care flow.

**Arguments**

| Argument     | Type      | Required | Description             |
| ------------ | --------- | -------- | ----------------------- |
| `pathway_id` | `String!` | Yes      | The ID of the care flow |

**Returns:** `TracksPayload!`

**Example**

```graphql
query TracksByPathway($pathway_id: String!) {
  tracksByPathway(pathway_id: $pathway_id) {
    code
    success
    tracks {
      can_trigger_manually
      id
      release_id
      title
    }
  }
}
```

Variables:

```json
{
  "pathway_id": "<string>"
}
```

## Mutations [#mutations]

### `addTrack` [#addtrack]

Adds a track to a care flow.

**Arguments**

| Argument | Type             | Required | Description                     |
| -------- | ---------------- | -------- | ------------------------------- |
| `input`  | `AddTrackInput!` | Yes      | The details of the track to add |

**Returns:** `AddTrackPayload!`

**Example**

```graphql
mutation AddTrack($input: AddTrackInput!) {
  addTrack(input: $input) {
    code
    success
  }
}
```

Variables:

```json
{
  "input": {
    "pathway_id": "<string>",
    "track_id": "<string>"
  }
}
```

### `scheduleTrack` [#scheduletrack]

Schedules a track to start on a future date.

**Arguments**

| Argument | Type                  | Required | Description                          |
| -------- | --------------------- | -------- | ------------------------------------ |
| `input`  | `ScheduleTrackInput!` | Yes      | The details of the track to schedule |

**Returns:** `ScheduleTrackPayload!`

**Example**

```graphql
mutation ScheduleTrack($input: ScheduleTrackInput!) {
  scheduleTrack(input: $input) {
    code
    id
    success
  }
}
```

Variables:

```json
{
  "input": {
    "pathway_id": "<string>",
    "scheduled_date": "<string>",
    "track_id": "<string>"
  }
}
```

### `stopTrack` [#stoptrack]

Stops a running track in a care flow.

**Arguments**

| Argument | Type              | Required | Description                      |
| -------- | ----------------- | -------- | -------------------------------- |
| `input`  | `StopTrackInput!` | Yes      | The details of the track to stop |

**Returns:** `StopTrackPayload!`

**Example**

```graphql
mutation StopTrack($input: StopTrackInput!) {
  stopTrack(input: $input) {
    code
    success
    track {
      activity_type
      context {
        action_id
        agent_config_id
        agent_id
        agent_thread_id
        instance_id
        pathway_id
        run_id
        step_id
        track_id
      }
      definition_id
      end_date
      id
      label {
        color
        id
        text
      }
      name
      parent_id
      stakeholders {
        id
        name
      }
      start_date
      status
      type
    }
  }
}
```

Variables:

```json
{
  "input": {
    "pathway_id": "<string>",
    "track_id": "<string>"
  }
}
```

### `unscheduleTracks` [#unscheduletracks]

Cancels one or more scheduled tracks.

**Arguments**

| Argument | Type                          | Required | Description                               |
| -------- | ----------------------------- | -------- | ----------------------------------------- |
| `input`  | `CancelScheduledTracksInput!` | Yes      | The IDs of the scheduled tracks to cancel |

**Returns:** `CancelScheduledTracksPayload!`

**Example**

```graphql
mutation UnscheduleTracks($input: CancelScheduledTracksInput!) {
  unscheduleTracks(input: $input) {
    code
    success
    unscheduled_ids
  }
}
```

Variables:

```json
{
  "input": {
    "ids": [
      "<string>"
    ]
  }
}
```
