# API calls & webhooks
URL: https://docs.awellhealth.com/api-reference/reference/api-calls-and-webhooks

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



Inspect the API calls and webhook calls a care flow makes, and retry failed ones.

## Queries [#queries]

### `apiCall` [#apicall]

Fetches a single API call by its ID.

**Arguments**

| Argument | Type      | Required | Description            |
| -------- | --------- | -------- | ---------------------- |
| `id`     | `String!` | Yes      | The ID of the API call |

**Returns:** `ApiCallPayload!`

**Example**

```graphql
query ApiCall($id: String!) {
  apiCall(id: $id) {
    api_call {
      created_at
      id
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      title
    }
    code
    success
  }
}
```

Variables:

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

### `apiCalls` [#apicalls]

Lists the API calls made by a care flow.

**Arguments**

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

**Returns:** `ApiCallsPayload!`

**Example**

```graphql
query ApiCalls($pathway_id: String!) {
  apiCalls(pathway_id: $pathway_id) {
    api_calls {
      created_at
      id
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      title
    }
    code
    success
  }
}
```

Variables:

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

### `webhookCall` [#webhookcall]

Fetches a single webhook call by its ID.

**Arguments**

| Argument          | Type      | Required | Description                |
| ----------------- | --------- | -------- | -------------------------- |
| `webhook_call_id` | `String!` | Yes      | The ID of the webhook call |

**Returns:** `WebhookCallPayload!`

**Example**

```graphql
query WebhookCall($webhook_call_id: String!) {
  webhookCall(webhook_call_id: $webhook_call_id) {
    code
    success
    webhook_call {
      created_at
      event_type
      id
      pathway {
        id
        pathway_definition_id
        patient_id
        start_date
      }
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      webhook_id
      webhook_name
    }
  }
}
```

Variables:

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

### `webhookCalls` [#webhookcalls]

Lists the webhook calls made by a care flow.

**Arguments**

| Argument     | Type                      | Required | Description                                                                                                  |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| `filters`    | `WebhookCallFiltersInput` | No       | Filters to apply to the webhook calls                                                                        |
| `pagination` | `PaginationParams`        | No       | How many results to return and the offset to start from — see [Pagination](/api-reference/guides/pagination) |
| `pathway_id` | `String!`                 | Yes      | The ID of the care flow                                                                                      |
| `sorting`    | `SortingParams`           | No       | The field to sort by and the sort direction — see [Pagination](/api-reference/guides/pagination)             |

**Returns:** `WebhookCallsPayload!`

**Example**

```graphql
query WebhookCalls($filters: WebhookCallFiltersInput, $pagination: PaginationParams, $pathway_id: String!, $sorting: SortingParams) {
  webhookCalls(filters: $filters, pagination: $pagination, pathway_id: $pathway_id, sorting: $sorting) {
    code
    pagination {
      count
      offset
      total_count
    }
    sorting {
      direction
      field
    }
    success
    webhook_calls {
      created_at
      event_type
      id
      pathway {
        id
        pathway_definition_id
        patient_id
        start_date
      }
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      webhook_id
      webhook_name
    }
  }
}
```

Variables:

```json
{
  "filters": {},
  "pagination": {
    "count": 0,
    "offset": 0
  },
  "pathway_id": "<string>",
  "sorting": {
    "direction": "<string>",
    "field": "<string>"
  }
}
```

### `webhookCallsForPathwayDefinition` [#webhookcallsforpathwaydefinition]

Lists the webhook calls made across all care flows of a care flow definition.

**Arguments**

| Argument                | Type                      | Required | Description                                                                                                  |
| ----------------------- | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| `filters`               | `WebhookCallFiltersInput` | No       | Filters to apply to the webhook calls                                                                        |
| `pagination`            | `PaginationParams`        | No       | How many results to return and the offset to start from — see [Pagination](/api-reference/guides/pagination) |
| `pathway_definition_id` | `String!`                 | Yes      | The ID of the care flow definition                                                                           |
| `sorting`               | `SortingParams`           | No       | The field to sort by and the sort direction — see [Pagination](/api-reference/guides/pagination)             |

**Returns:** `WebhookCallsPayload!`

**Example**

```graphql
query WebhookCallsForPathwayDefinition($filters: WebhookCallFiltersInput, $pagination: PaginationParams, $pathway_definition_id: String!, $sorting: SortingParams) {
  webhookCallsForPathwayDefinition(filters: $filters, pagination: $pagination, pathway_definition_id: $pathway_definition_id, sorting: $sorting) {
    code
    pagination {
      count
      offset
      total_count
    }
    sorting {
      direction
      field
    }
    success
    webhook_calls {
      created_at
      event_type
      id
      pathway {
        id
        pathway_definition_id
        patient_id
        start_date
      }
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      webhook_id
      webhook_name
    }
  }
}
```

Variables:

```json
{
  "filters": {},
  "pagination": {
    "count": 0,
    "offset": 0
  },
  "pathway_definition_id": "<string>",
  "sorting": {
    "direction": "<string>",
    "field": "<string>"
  }
}
```

### `webhookCallsForTenant` [#webhookcallsfortenant]

Lists the webhook calls made across the tenant.

**Arguments**

| Argument     | Type                      | Required | Description                                                                                                  |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| `filters`    | `WebhookCallFiltersInput` | No       | Filters to apply to the webhook calls                                                                        |
| `pagination` | `PaginationParams`        | No       | How many results to return and the offset to start from — see [Pagination](/api-reference/guides/pagination) |
| `sorting`    | `SortingParams`           | No       | The field to sort by and the sort direction — see [Pagination](/api-reference/guides/pagination)             |

**Returns:** `WebhookCallsPayload!`

**Example**

```graphql
query WebhookCallsForTenant($filters: WebhookCallFiltersInput, $pagination: PaginationParams, $sorting: SortingParams) {
  webhookCallsForTenant(filters: $filters, pagination: $pagination, sorting: $sorting) {
    code
    pagination {
      count
      offset
      total_count
    }
    sorting {
      direction
      field
    }
    success
    webhook_calls {
      created_at
      event_type
      id
      pathway {
        id
        pathway_definition_id
        patient_id
        start_date
      }
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      webhook_id
      webhook_name
    }
  }
}
```

Variables:

```json
{
  "filters": {},
  "pagination": {
    "count": 0,
    "offset": 0
  },
  "sorting": {
    "direction": "<string>",
    "field": "<string>"
  }
}
```

## Mutations [#mutations]

### `retryAllApiCalls` [#retryallapicalls]

Retries all API calls for a care flow.

**Arguments**

| Argument | Type                     | Required | Description                            |
| -------- | ------------------------ | -------- | -------------------------------------- |
| `input`  | `RetryAllApiCallsInput!` | Yes      | The care flow whose API calls to retry |

**Returns:** `EmptyPayload!`

**Example**

```graphql
mutation RetryAllApiCalls($input: RetryAllApiCallsInput!) {
  retryAllApiCalls(input: $input) {
    code
    success
  }
}
```

Variables:

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

### `retryAllFailedApiCalls` [#retryallfailedapicalls]

Retries all failed API calls for a care flow.

**Arguments**

| Argument | Type                           | Required | Description                                   |
| -------- | ------------------------------ | -------- | --------------------------------------------- |
| `input`  | `RetryAllFailedApiCallsInput!` | Yes      | The care flow whose failed API calls to retry |

**Returns:** `EmptyPayload!`

**Example**

```graphql
mutation RetryAllFailedApiCalls($input: RetryAllFailedApiCallsInput!) {
  retryAllFailedApiCalls(input: $input) {
    code
    success
  }
}
```

Variables:

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

### `retryAllFailedWebhookCalls` [#retryallfailedwebhookcalls]

Retries all failed webhook calls for a care flow.

**Arguments**

| Argument | Type                               | Required | Description                                       |
| -------- | ---------------------------------- | -------- | ------------------------------------------------- |
| `input`  | `RetryAllFailedWebhookCallsInput!` | Yes      | The care flow whose failed webhook calls to retry |

**Returns:** `EmptyPayload!`

**Example**

```graphql
mutation RetryAllFailedWebhookCalls($input: RetryAllFailedWebhookCallsInput!) {
  retryAllFailedWebhookCalls(input: $input) {
    code
    success
  }
}
```

Variables:

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

### `retryAllFailedWebhookCallsForPathwayDefinition` [#retryallfailedwebhookcallsforpathwaydefinition]

Retries all failed webhook calls across all care flows of a care flow definition.

**Arguments**

| Argument | Type                                                   | Required | Description                                                  |
| -------- | ------------------------------------------------------ | -------- | ------------------------------------------------------------ |
| `input`  | `RetryAllFailedWebhookCallsForPathwayDefinitionInput!` | Yes      | The care flow definition whose failed webhook calls to retry |

**Returns:** `EmptyPayload!`

**Example**

```graphql
mutation RetryAllFailedWebhookCallsForPathwayDefinition($input: RetryAllFailedWebhookCallsForPathwayDefinitionInput!) {
  retryAllFailedWebhookCallsForPathwayDefinition(input: $input) {
    code
    success
  }
}
```

Variables:

```json
{
  "input": {
    "pathway_definition_id": "<string>"
  }
}
```

### `retryAllWebhookCalls` [#retryallwebhookcalls]

Retries all webhook calls for a care flow.

**Arguments**

| Argument | Type                         | Required | Description                                |
| -------- | ---------------------------- | -------- | ------------------------------------------ |
| `input`  | `RetryAllWebhookCallsInput!` | Yes      | The care flow whose webhook calls to retry |

**Returns:** `EmptyPayload!`

**Example**

```graphql
mutation RetryAllWebhookCalls($input: RetryAllWebhookCallsInput!) {
  retryAllWebhookCalls(input: $input) {
    code
    success
  }
}
```

Variables:

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

### `retryApiCall` [#retryapicall]

Retries a single API call.

**Arguments**

| Argument | Type                 | Required | Description           |
| -------- | -------------------- | -------- | --------------------- |
| `input`  | `RetryApiCallInput!` | Yes      | The API call to retry |

**Returns:** `RetryApiCallPayload!`

**Example**

```graphql
mutation RetryApiCall($input: RetryApiCallInput!) {
  retryApiCall(input: $input) {
    api_call {
      created_at
      id
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      title
    }
    code
    success
  }
}
```

Variables:

```json
{
  "input": {
    "api_call_id": "<string>"
  }
}
```

### `retryPushToEmr` [#retrypushtoemr]

Retries pushing an activity's data to the EMR.

**Arguments**

| Argument | Type                   | Required | Description                                 |
| -------- | ---------------------- | -------- | ------------------------------------------- |
| `input`  | `RetryPushToEmrInput!` | Yes      | The activity whose push to the EMR to retry |

**Returns:** `EmptyPayload!`

**Example**

```graphql
mutation RetryPushToEmr($input: RetryPushToEmrInput!) {
  retryPushToEmr(input: $input) {
    code
    success
  }
}
```

Variables:

```json
{
  "input": {
    "activity_id": "<string>"
  }
}
```

### `retryWebhookCall` [#retrywebhookcall]

Retries a single webhook call.

**Arguments**

| Argument | Type                     | Required | Description               |
| -------- | ------------------------ | -------- | ------------------------- |
| `input`  | `RetryWebhookCallInput!` | Yes      | The webhook call to retry |

**Returns:** `RetryWebhookCallPayload!`

**Example**

```graphql
mutation RetryWebhookCall($input: RetryWebhookCallInput!) {
  retryWebhookCall(input: $input) {
    code
    success
    webhook_call {
      created_at
      event_type
      id
      pathway {
        id
        pathway_definition_id
        patient_id
        start_date
      }
      request {
        body
        endpoint
        method
      }
      responses {
        body
        date
        status
      }
      status
      webhook_id
      webhook_name
    }
  }
}
```

Variables:

```json
{
  "input": {
    "webhook_call_id": "<string>"
  }
}
```
