<!-- https://staircase.co/delivery/shipping/health -->
# Health

# Health

Per-transaction metrics, cost metrics, and a per-partner performance report carrying vendor success rate and cost.

Every invocation reports timing, outcome and cost. The surface serves that back as transaction metrics, cost metrics, custom report templates, and the public status view.

The per-partner report carries success rate and cost per vendor, which is the measurement a waterfall ordering is retuned from — the ordering is only as good as the evidence that a vendor is answering.

## How it works

Vendor performance was reported from the beginning rather than added once someone asked. That is the difference between a waterfall as an idea and a waterfall that can be tuned: without per-vendor success and cost, the order is a guess that nobody can correct.

## Operations

<!--source:api-specifications-->

### Status
<!--/source-->

`POST` `/`

<!--source:api-specifications-->

#### Update status
<!--/source-->

`updateHealthStatus`

<!--source:api-specifications-->
Update product status
<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "product_id": "test_product",
 "product_api_id": "test_api",
 "environment_fqdn": "test_env.example.com",
 "available": true
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Successfully updated product status

```
{
 "product_id": "test_product",
 "status": "operational"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data invalid

```
{
 "message": "Request body is invalid."
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_id`required | `string` | <!--source:api-specifications-->Product ID<!--/source--> |
| `status`required | `string` | <!--source:api-specifications-->Status<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Successfully updated product status
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_id`required | `string` | <!--source:api-specifications-->Category<!--/source--> |
| `status`required | `string` | <!--source:api-specifications-->Status<!--/source-->`major_outage``operational``partial_outage` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data invalid
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/{product_id}`

<!--source:api-specifications-->

#### Retrieve status
<!--/source-->

`getHealthStatus`

<!--source:api-specifications-->
Get product status
<!--/source-->

<!--source:api-specifications-->
Get product availability status

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Successfully fetched product status

```
{
 "product_id": "test_product",
 "status": "operational"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data invalid

```
{
 "message": "Request body is invalid."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `product_id` required | `string` path | `01GYWNA8PJX5A41WA48PZNV5Y4` | <!--source:api-specifications-->Product ID<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Successfully fetched product status
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_id`required | `string` | <!--source:api-specifications-->Category<!--/source--> |
| `status`required | `string` | <!--source:api-specifications-->Status<!--/source-->`major_outage``operational``partial_outage` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data invalid
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Metric Alarm Events
<!--/source-->

`GET` `/alarms/events`

<!--source:api-specifications-->

#### List Metric Alarm Events
<!--/source-->

`list_metric_alarm_events`

<!--source:api-specifications-->
This service returns a list of occurred alarm events. NOTE: Alarm events have one week retention period. Events that passed the retention period will be deleted.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 error response400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "events": [
 {
 "expire_at": 1663939815,
 "event_id": "2f9e3499-8e5d-4003-b524-ed23aca2ac38",
 "metric_data": {
 "transaction_id": "01GD37M86FM1AZ2QXQ243NDKHE",
 "product_identifier": "c72b3b7c-dc30-41d0-81d3-3d3889370ef2",
 "product_api_identifier": "77958f4b-7158-42d0-adbd-22e2b74fe0c9",
 "invocation_code": "2000",
 "elapsed_time": 147.4666051864624,
 "created_at": "2022-09-16 09:30:13",
 "response_collection_id": "d4f48c0f-6560-4da9-8c8d-a54d10d22d7e",
 "id": "37e9b907-ef5b-4e54-b782-de1e64259a80",
 "configuration_id": "e1b96c6d-d24e-459c-ae8a-ec460df3de8f",
 "product_build_hash": "f144ef21958ba7cde95a9bbd5372ec99605af106",
 "host_environment": "health.staircaseapi.com",
 "status": "SUCCEEDED"
 },
 "created_at": "2022-09-16T09:30:13",
 "alarm_id": "alarm_id_1"
 }
 ],
 "next_token": null
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response example

```
{
 "Error": "Invalid Parameter document"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response example

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
7
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `alarm_id` required | `string` query | `product_identifier_1` | <!--source:api-specifications-->Alarm ID<!--/source--> |
| `start_date` required | `string` query | `2022-01-01T00:00:00` | <!--source:api-specifications-->Start date in ISO format<!--/source--> |
| `end_date` required | `string` query | `2022-01-01T01:01:01` | <!--source:api-specifications-->End date in ISO format<!--/source--> |
| `next_token` | `string` query | `eyJwcm9kdWN0X25hbWUiOiAiQnVpbGQiLCAiY3JlYXRlZF9hdCI6ICIyMDIxLTA2LTA0VDE0OjU5OjE5LjU3MTg3OSJ9` | <!--source:api-specifications-->The token for the next set of items to return.<!--/source--> |
| `limit` | `string` query | `150` | <!--source:api-specifications-->The number of results to return in this request<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `events` | `object[]` | <!--source:api-specifications-->List of events<!--/source--> |
| `alarm_id` | `string` | <!--source:api-specifications-->Alarm ID<!--/source-->Example `alarm_id_1` |
| `event_id` | `string` | <!--source:api-specifications-->Event ID<!--/source-->Example `event_id_1` |
| `created_at` | `string` | <!--source:api-specifications-->Event creation date.<!--/source-->Example `2022-09-16T09:30:13` |
| `expire_at` | `integer` | <!--source:api-specifications-->Event item expiration timestamp.<!--/source-->Example `1663939815` |
| `metric_data` | `object` | <!--source:api-specifications-->Metric payload<!--/source--> |
| `id` | `string` | <!--source:api-specifications-->Metric ID<!--/source-->Example `37e9b907-ef5b-4e54-b782-de1e64259a80` |
| `host_environment` | `string` | <!--source:api-specifications-->Metric host environment<!--/source-->Example `health.staircaseapi.com` |
| `product_identifier` | `string` | <!--source:api-specifications-->Product Identifier<!--/source-->Example `c72b3b7c-dc30-41d0-81d3-3d3889370ef2` |
| `product_api_identifier` | `string` | <!--source:api-specifications-->Product API identifier<!--/source-->Example `77958f4b-7158-42d0-adbd-22e2b74fe0c9` |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction ID<!--/source-->Example `01GD37M86FM1AZ2QXQ243NDKHE` |
| `response_collection_id` | `string` | <!--source:api-specifications-->Response collection ID<!--/source-->Example `d4f48c0f-6560-4da9-8c8d-a54d10d22d7e` |
| `elapsed_time` | `number` | <!--source:api-specifications-->Elapsed time<!--/source-->Example `147.46` |
| `status` | `string` | <!--source:api-specifications-->Status<!--/source-->Example `SUCCEEDED` |
| `invocation_code` | `string` | <!--source:api-specifications-->Invocation code<!--/source-->Example `2000` |
| `configuration_id` | `string` | <!--source:api-specifications-->Product configuration ID<!--/source-->Example `e1b96c6d-d24e-459c-ae8a-ec460df3de8f` |
| `product_build_hash` | `string` | <!--source:api-specifications-->Product build hash<!--/source-->Example `f144ef21958ba7cde95a9bbd5372ec99605af106` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response example
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Metric Alarms
<!--/source-->

`POST` `/alarms/metric`

<!--source:api-specifications-->

#### Create Metric Alarm
<!--/source-->

`create_metric_alarms`

<!--source:api-specifications-->

#### Metric Alarm

Health alarms provide real-time alerts based on a given condition. If you want to be notified when an alert event has occurred, you can select a destination option. You are able to select one or more destination channels from the available options.

##### Condition

Health alarms are generated based on given conditions.

##### Destinations

Notification can be delivered after the alert event has occurred. Destinations are notification channels for alert delivery. One or more notification channels can be selected ex: Slack, and Webhook.

- Slack: Slack integration requires a slack token that belongs to Slack apps. Please create a new application by using Slack API. After application creation, go to channel configuration and add created Slack app as an integration using "Apps" section in the "Integrations" tab.

<!--/source-->

##### Request

<!--source:api-specifications-->
Create Metric AlarmAlarm Only If campaign_id is present in metric
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "alarm_id": "alarm_id_1",
 "condition": {
 "product_identifier": "product_identifier_1",
 "product_api_identifiers": [
 "product_api_identifier_1"
 ]
 },
 "destinations": [
 {
 "type": "SLACK",
 "slack_channel": "slack_channel_1",
 "slack_token": "slack_token_1",
 "slack_usergroup_id": "S03TW2A7A3U"
 },
 {
 "type": "WEBHOOK",
 "url": "https://webhook.com"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "alarm_id": "alarm_id_1",
 "condition": {
 "product_identifier": "product_identifier_1",
 "required_properties": [
 "campaign_id"
 ]
 },
 "destinations": [
 {
 "type": "SLACK",
 "slack_channel": "slack_channel_1",
 "slack_token": "slack_token_1",
 "slack_usergroup_id": "S03TW2A7A3U"
 },
 {
 "type": "WEBHOOK",
 "url": "https://webhook.com"
 }
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success response.

```
{
 "message": "migration configuration created"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "message": "Bad Request"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `alarm_id`required | `string` | <!--source:api-specifications-->Unique alarm ID<!--/source--> |
| `condition`required | `object` | <!--source:api-specifications-->Alarm filter configuration<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Host environment<!--/source--> |
| `product_identifier`required | `string` | <!--source:api-specifications-->Product identifier<!--/source--> |
| `product_api_identifiers` | `string[]` | <!--source:api-specifications-->List of product api identifiers<!--/source--> |
| `configuration_ids` | `string[]` | <!--source:api-specifications-->List of product configuration ID<!--/source--> |
| `statuses` | `string[]` | <!--source:api-specifications-->List of status<!--/source--> |
| `invocation_codes` | `string[]` | <!--source:api-specifications-->List of invocation codes<!--/source--> |
| `product_build_hash` | `string` | <!--source:api-specifications-->Product build hash<!--/source--> |
| `elapsed_time_above` | `number` | <!--source:api-specifications-->Filters metrics which has elapsed time above<!--/source--> |
| `elapsed_time_below` | `number` | <!--source:api-specifications-->Filters metrics which has elapsed time below<!--/source--> |
| `required_properties` | `string[]` | <!--source:api-specifications-->List of required properties<!--/source--> |
| `destinations`required | `array` | <!--source:api-specifications-->List of alarm destinations<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message response<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`PUT` `/alarms/metric/{alarm_id}`

<!--source:api-specifications-->

#### Update Metric Alarm
<!--/source-->

`update_metric_alarm`

<!--source:api-specifications-->
This service updates metric alarm.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "condition": {
 "product_identifier": "product_identifier_1",
 "product_api_identifiers": [
 "product_api_identifier_1"
 ]
 },
 "destinations": [
 {
 "type": "SLACK",
 "slack_channel": "slack_channel_1",
 "slack_token": "slack_token_1"
 },
 {
 "type": "WEBHOOK",
 "url": "https://webhook.com"
 }
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success response.

```
{
 "message": "migration configuration updated"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "message": "Bad Request"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
4
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `alarm_id` required | `string` path | `alarm_id_1` | <!--source:api-specifications-->Unique alarm ID<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `condition`required | `object` | <!--source:api-specifications-->Alarm filter configuration<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Host environment<!--/source--> |
| `product_identifier`required | `string` | <!--source:api-specifications-->Product identifier<!--/source--> |
| `product_api_identifiers` | `string[]` | <!--source:api-specifications-->List of product api identifiers<!--/source--> |
| `statuses` | `string[]` | <!--source:api-specifications-->List of status<!--/source--> |
| `invocation_codes` | `string[]` | <!--source:api-specifications-->List of invocation codes<!--/source--> |
| `configuration_ids` | `string[]` | <!--source:api-specifications-->List of product configuration ID<!--/source--> |
| `product_build_hash` | `string` | <!--source:api-specifications-->Product build hash<!--/source--> |
| `elapsed_time_above` | `number` | <!--source:api-specifications-->Filters metrics which has elapsed time above<!--/source--> |
| `elapsed_time_below` | `number` | <!--source:api-specifications-->Filters metrics which has elapsed time below<!--/source--> |
| `slack_usergroup_id` | `string` | <!--source:api-specifications-->Slack usergroup id. Use this to tag your team group in the slack message. This ID ALWAYS starts with S and is followed by 9 characters.<!--/source-->Example `slack_usergroup_id_1` |
| `required_properties` | `string[]` | <!--source:api-specifications-->List of required properties<!--/source--> |
| `destinations`required | `array` | <!--source:api-specifications-->List of alarm destinations<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message response<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`GET` `/alarms/metric`

<!--source:api-specifications-->

#### List Metric Alarms
<!--/source-->

`list_metric_alarms`

<!--source:api-specifications-->
This service returns list of metric alarms.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 error response400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "alarms": [
 {
 "destinations": [
 {
 "type": "SLACK",
 "slack_channel": "slack_channel_1",
 "slack_token": "slack_token_1"
 }
 ],
 "alarm_id": "alarm_id_1",
 "condition": {
 "product_api_identifiers": [
 "product_api_identifier_1"
 ],
 "product_identifier": "product_identifier_1"
 }
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response example

```
{
 "Error": "Invalid Parameter document"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response example

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `product_identifier` | `string` query | `product_identifier_1` | <!--source:api-specifications-->Filters by product identifier<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `alarms` | `object[]` | <!--source:api-specifications-->Configurations<!--/source--> |
| `alarm_id` | `string` | <!--source:api-specifications-->Unique configuration name. Value can be alphanumeric and underscore characters only.<!--/source-->Example `test_configuration` |
| `condition` | `object` | <!--source:api-specifications-->Target environment API key<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Host environment<!--/source-->Example `health.staircaseapi.com` |
| `product_identifier` | `string` | <!--source:api-specifications-->Product identifier<!--/source-->Example `ccd6b8dd-02a7-4c64-a983-7e0c108cd666` |
| `product_api_identifiers` | `array` | <!--source:api-specifications-->List of api identifiers<!--/source--> |
| `statuses` | `array` | <!--source:api-specifications-->List of status<!--/source--> |
| `invocation_codes` | `array` | <!--source:api-specifications-->List of invocation codes<!--/source--> |
| `configuration_ids` | `array` | <!--source:api-specifications-->List of configuration ID<!--/source--> |
| `product_build_hash` | `string` | <!--source:api-specifications-->Product build hash<!--/source--> |
| `elapsed_time_above` | `number` | <!--source:api-specifications-->Elapsed time above filter<!--/source-->Example `5` |
| `elapsed_time_below` | `number` | <!--source:api-specifications-->Elapsed time below filter<!--/source-->Example `10` |
| `destinations` | `array` | <!--source:api-specifications-->List of alarm destinations<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response example
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`GET` `/alarms/metric/{alarm_id}`

<!--source:api-specifications-->

#### Get Metric Alarm
<!--/source-->

`get_metric_alarms`

<!--source:api-specifications-->
This service returns metric alarms.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 error response400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "destinations": [
 {
 "type": "SLACK",
 "slack_channel": "slack_channel_1",
 "slack_token": "slack_token_1"
 }
 ],
 "alarm_id": "alarm_id_1",
 "condition": {
 "product_api_identifiers": [
 "product_api_identifier_1"
 ],
 "product_identifier": "product_identifier_1"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response example

```
{
 "Error": "Invalid Parameter document"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response example

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
4
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `alarm_id` required | `string` path | `alarm_id_1` | <!--source:api-specifications-->Unique alarm ID<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `alarm_id` | `string` | <!--source:api-specifications-->Unique configuration name. Value can be alphanumeric and underscore characters only.<!--/source-->Example `test_configuration` |
| `condition` | `object` | <!--source:api-specifications-->Target environment API key<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Host environment<!--/source-->Example `health.staircaseapi.com` |
| `product_identifier` | `string` | <!--source:api-specifications-->Product identifier<!--/source-->Example `ccd6b8dd-02a7-4c64-a983-7e0c108cd666` |
| `product_api_identifiers` | `array` | <!--source:api-specifications-->List of api identifiers<!--/source--> |
| `statuses` | `array` | <!--source:api-specifications-->List of status<!--/source--> |
| `invocation_codes` | `array` | <!--source:api-specifications-->List of invocation codes<!--/source--> |
| `configuration_ids` | `array` | <!--source:api-specifications-->List of configuration ID<!--/source--> |
| `product_build_hash` | `string` | <!--source:api-specifications-->Product build hash<!--/source--> |
| `elapsed_time_above` | `number` | <!--source:api-specifications-->Elapsed time above filter<!--/source-->Example `5` |
| `elapsed_time_below` | `number` | <!--source:api-specifications-->Elapsed time below filter<!--/source-->Example `10` |
| `destinations` | `array` | <!--source:api-specifications-->List of alarm destinations<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response example
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`DELETE` `/alarms/metric/{alarm_id}`

<!--source:api-specifications-->

#### Delete Metric Alarm
<!--/source-->

`delete_metric_alarm`

<!--source:api-specifications-->
This service deletes metric alarm.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 error response400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "message": "migration configuration deleted"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response example

```
{
 "Error": "Invalid Parameter document"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response example

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
4
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `alarm_id` required | `string` path | `alarm_id_1` | <!--source:api-specifications-->Unique alarm ID<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Unique configuration name<!--/source-->Example `test_configuration` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response example
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Custom Reports
<!--/source-->

`POST` `/build-report`

<!--source:api-specifications-->

#### Create Custom Report
<!--/source-->

`create_custom_report`

<!--source:api-specifications-->
Build a custom report using the metrics posted for any product or custom-created metric types.
<!--/source-->

<!--source:api-specifications-->
Build a custom report using the metrics posted for any product or custom-created metric types. Define the fields to retrieve, the filters to apply, and the aggregation if needed.

The report data to retrieve can be defined in two ways:

- Aggregated:Providing the aggregation function, aggregation_fields and group_by will allow to bring the results aggregated.

- Detailed:Specify the fields and filters to retrieve detailed metrics data.

<!--/source-->

##### Request

<!--source:api-specifications-->
Examples - Detailed reportExample - Aggregated
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "get": [
 "product_name",
 "status",
 "transaction_id",
 "request_collection_id",
 "response_collection_id",
 "operation_status",
 "partner_name",
 "severity",
 "service_endpoint"
 ],
 "filters": {
 "product_name": [
 "Health",
 "Account"
 ],
 "status": [
 "succeeded"
 ],
 "host_env": [
 "health.staircaseapi.com"
 ]
 },
 "report_name": "report_to_create_name",
 "metric_type": "performance"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "get": [
 "product_name",
 "service_endpoint",
 "status"
 ],
 "filters": {
 "product_name": [
 "Health"
 ]
 },
 "aggregation": "count",
 "aggregation_field": "transaction_id",
 "group_by": [
 "product_name",
 "service_endpoint",
 "status"
 ],
 "report_name": "report_to_create_name",
 "metric_type": "performance"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 0400 text/html403502
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success Response

```
{
 "message": "the custom report was successfully created"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Bad request error

```
{
 "message": "Error in metric_type creation: the Report simples2 already exists"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Bad request error

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error.

```
{
 "message": "Internal server error"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
7 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `get` | `string[]` | <!--source:api-specifications-->Items which will be retrieved (product_name, status, transaction_id,request_collection_id,response_collection_id,operation_status,partner_name,severity,service_endpoint,created_at)<!--/source--> |
| `metric_type` | `string` | <!--source:api-specifications-->The name of the metric type created or use "performance" for transaction and logging metrics posted in the Health.<!--/source--> |
| `aggregation` | `string` | <!--source:api-specifications-->For aggregated reports, it will calculate the given function (count, avg, sum)<!--/source--> |
| `aggregation_field` | `string` | <!--source:api-specifications-->For aggregated reports, it will calculate the aggregation function with this field. Example(transaction_id, response_collection_id)<!--/source--> |
| `group_by` | `array` | <!--source:api-specifications-->For aggregated reports, it will group the data by these fields. Example(product_name, service_endpoint)<!--/source--> |
| `filters` | `object` | <!--source:api-specifications-->Filters applied for the report<!--/source--> |
| `environment` | `string[]` | <!--source:api-specifications-->Environment example<!--/source--> |
| `product_name` | `string[]` | <!--source:api-specifications-->Product Name Example<!--/source--> |
| `status` | `string[]` | <!--source:api-specifications-->Status Example<!--/source--> |
| `report_name` | `string` | <!--source:api-specifications-->Name of the Report.<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Bad request error
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `502``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message error<!--/source--> |

`GET` `/get-report`

<!--source:api-specifications-->

#### Retrieve Custom Report
<!--/source-->

`get_custom_report`

<!--source:api-specifications-->
This service runs a custom report and allows to retrieve the results for the given report structure.
<!--/source-->

<!--source:api-specifications-->
This service runs a custom report and allows to retrieve the results for the given report structure. The start and end date defines the report data timeframe, also the filters are applied.

See the service Update custom report to change the structure of the report.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 0400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success

```
{
 "Items": [
 {
 "product_name": "Assess",
 "status": "succeeded",
 "transaction_id": "1ce37c58-12aa-400f-a7b6-97f5d63b0e50",
 "host_env": "health.staircaseapi.com",
 "created_at": "2021-06-25 14:03:03.504"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response

```
{
 "message": "Error in report retrieving: there is no report with the report_name equals: simples221"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
4
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `report_name` required | `string` query | `simples221` | <!--source:api-specifications-->The name of the Report<!--/source--> |
| `start_date` required | `string` query | `2021-01-01` | <!--source:api-specifications-->Start date<!--/source--> |
| `end_date` required | `string` query | `2021-06-30` | <!--source:api-specifications-->End date<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Items` | `object[]` | <!--source:api-specifications-->Items<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `host_env` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Field name<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`PUT` `/update-build-report`

<!--source:api-specifications-->

#### Update Custom Report
<!--/source-->

`update_custom_report`

<!--source:api-specifications-->
This service allows updating a custom report structure.
<!--/source-->

<!--source:api-specifications-->
This service allows updating a custom report structure.

<!--/source-->

##### Request

<!--source:api-specifications-->
Examples - Detailed reportExample - Aggregated
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "get": [
 "product_name",
 "status",
 "transaction_id",
 "request_collection_id",
 "response_collection_id",
 "operation_status",
 "partner_name",
 "severity",
 "service_endpoint"
 ],
 "filters": {
 "product_name": [
 "Health",
 "Account"
 ],
 "status": [
 "succeeded"
 ],
 "environment": [
 "health.staircaseapi.com"
 ]
 },
 "report_name": "report_to_create_name",
 "metric_type": "performance"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "get": [
 "product_name",
 "service_endpoint",
 "status"
 ],
 "filters": {
 "product_name": [
 "Health"
 ]
 },
 "aggregation": "count",
 "aggregation_field": "transaction_id",
 "group_by": [
 "product_name",
 "service_endpoint",
 "status"
 ],
 "report_name": "report_to_create_name",
 "metric_type": "performance"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400403502
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success Response

```
{
 "message": "the custom report was successfully updated"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 400 Bad Request

```
{
 "message": "Error in updating report: the Report report_to_create_name does not exist"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error.

```
{
 "message": "Internal server error"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `get` | `string[]` | <!--source:api-specifications-->Items which will be retrieved (product_name, status, transaction_id,request_collection_id,response_collection_id,operation_status,partner_name,severity,service_endpoint,created_at)<!--/source--> |
| `metric_type` | `string` | <!--source:api-specifications-->The name of the metric type created or use "performance" for transaction and logging metrics posted in the Health.<!--/source--> |
| `filters` | `object` | <!--source:api-specifications-->Filters applied for the report<!--/source--> |
| `environment` | `string[]` | <!--source:api-specifications-->Environment example<!--/source--> |
| `product_name` | `string[]` | <!--source:api-specifications-->Product Name Example<!--/source--> |
| `status` | `string[]` | <!--source:api-specifications-->Status Example<!--/source--> |
| `report_name` | `string` | <!--source:api-specifications-->Name of the Report.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
400 Bad Request
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `502``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message error<!--/source--> |

`GET` `/get-report-id`

<!--source:api-specifications-->

#### Retrieve Custom Report Id
<!--/source-->

`get_custom_report_id`

<!--source:api-specifications-->
This service runs a custom report and allows to retrieve the results for the given report structure.
<!--/source-->

<!--source:api-specifications-->
This service runs a custom report and allows to retrieve the results for the given report structure. The start and end date defines the report data timeframe, also the filters are applied.

The response will be a report id which could be used to retrieve the report using the service /get-report-result See the service Update custom report to change the structure of the report.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 0400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success

```
{
 "report_id": "4e6a5826-9a18-4656-b527-03dd7ad1b258",
 "Items": []
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response

```
{
 "message": "Error in report retrieving: there is no report with the report_name equals: simples221"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
4
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `report_name` required | `string` query | `simples221` | <!--source:api-specifications-->The name of the Report<!--/source--> |
| `start_date` required | `string` query | `2021-01-01` | <!--source:api-specifications-->Start date<!--/source--> |
| `end_date` required | `string` query | `2021-06-30` | <!--source:api-specifications-->End date<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Success
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report_id` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `Items` | `array` | <!--source:api-specifications-->Items<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/get-report-result`

<!--source:api-specifications-->

#### Retrieve Custom Report CSV
<!--/source-->

`get_custom_report_results_csv`

<!--source:api-specifications-->
This service runs a custom report and allows to retrieve the results as a pre signed URL which contains a CSV file with the report results.
<!--/source-->

<!--source:api-specifications-->
This service runs a custom report and allows to retrieve the results for the given report structure. The start and end date defines the report data timeframe, also the filters are applied.

See the service Update custom report to change the structure of the report.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 0400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success

```
{
 "Items": [
 {
 "product_name": "Assess",
 "status": "succeeded",
 "transaction_id": "1ce37c58-12aa-400f-a7b6-97f5d63b0e50",
 "host_env": "health.staircaseapi.com",
 "created_at": "2021-06-25 14:03:03.504"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response

```
{
 "message": "Error in report retrieving: there is no report with the report_name equals: simples221"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `report_id` required | `string` query | `simples221` | <!--source:api-specifications-->The id of the report<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Items` | `object[]` | <!--source:api-specifications-->Items<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `host_env` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Field name<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Field name<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Cost Metrics
<!--/source-->

`POST` `/cost-metric`

<!--source:api-specifications-->

#### Create a Cost Metric
<!--/source-->

`create_cost_metric`

<!--source:api-specifications-->
Create a cost metric. These metrics are used to track customer costs.
<!--/source-->

##### Request

<!--source:api-specifications-->
Example Cost metricExample Cost Mortgage
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "product_name": "Health",
 "transaction_id": "3041fe98-4005-438d-9e14-5849ed8d6cc6",
 "cost_in_cents": 95,
 "cost_category": "customer"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "product_name": "Data Extraction",
 "transaction_id": "1234",
 "cost_in_cents": 25,
 "partner": "softworks",
 "document_type": "W2",
 "request_collection_id": "01FH8712A4W0TDKGQQ5QF9B8S",
 "response_collection_id": "01FHAZNF0E0070QSKYS6DW62EH",
 "pages": "1",
 "cost_category": "partner"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success response.

```
{
 "message": "cost metric created"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "message": "error in store cost metric"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->Key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
9 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id`required | `string` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source--> |
| `cost_in_cents`required | `number` | <!--source:api-specifications-->The Cost in cents. It must be an integer number.<!--/source--> |
| `pages` | `string` | <!--source:api-specifications-->The number of pages of a document used for data extraction.<!--/source--> |
| `partner` | `string` | <!--source:api-specifications-->Partner<!--/source--> |
| `product_name`required | `string` | <!--source:api-specifications-->The system that is exposed externally to customers and performs the action. Examples Assess, Build, Employment.<!--/source--> |
| `document_type` | `string` | <!--source:api-specifications-->The type of document in the data extraction. Example: W2cost: the cost price.<!--/source--> |
| `cost_category`required | `string` | <!--source:api-specifications-->There are only two types of cost_category allowed (partner and customer)<!--/source-->Example `customer` |
| `request_collection_id` | `string (string)` | <!--source:api-specifications-->A request collection in Staircase is a container for the elements that a product needs to execute. For example, an AUS collection is a digital representation of a loan application, while a Data Extraction collection is a digital representation of a document.<!--/source-->Example `01F2MHXNNNVK02YEY63Q5EQ59T` |
| `response_collection_id` | `string (string)` | <!--source:api-specifications-->A response collection in Staircase is a container for the elements that a product has as an output for its execution.<!--/source-->Example `01F2MHXNNNVK02YEY63Q5EQ59T` |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message response<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/cost-metric`

<!--source:api-specifications-->

#### Retrieve a Cost Metric
<!--/source-->

`get_cost_metric`

<!--source:api-specifications-->
Retrieve a list of cost metric. These metrics are used to track customer costs.
<!--/source-->

##### Response

<!--source:api-specifications-->
200400 error response400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "cost_metrics": [
 {
 "product_name": "Health",
 "transaction_id": "2345678a",
 "cost_in_cents": "123",
 "partner": "test-partner",
 "document_type": "test-1",
 "pages": "223",
 "created_at": "2021-10-04 15:06:06.720"
 },
 {
 "product_name": "Health",
 "transaction_id": "2345678a",
 "cost_in_cents": "162",
 "partner": "test-partner",
 "document_type": "test-1",
 "pages": "223",
 "created_at": "2021-10-04 15:06:13.462"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response example

```
{
 "Error": "Invalid Parameter document"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response example

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
11
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` | `string` query | `2345678a` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source--> |
| `product_name` | `string` query | `Health` | <!--source:api-specifications-->The system that is exposed externally to customers and performs the action. Examples Assess, Build, Employment.<!--/source--> |
| `partner` | `string` query | `softworks` | <!--source:api-specifications-->Partner<!--/source--> |
| `cost_in_cents` | `string` query | `95` | <!--source:api-specifications-->Cost<!--/source--> |
| `pages` | `string` query | `110` | <!--source:api-specifications-->The number of pages of a document used for data extraction.<!--/source--> |
| `cost_category` | `string` query | `partner` | <!--source:api-specifications-->Cost category the metric belongs to.<!--/source--> |
| `document_type` | `string` query | `test-1` | <!--source:api-specifications-->The type of document in the data extraction.<!--/source--> |
| `start_date` | `string` query | `2021-04-13` | <!--source:api-specifications-->If provided, filters by start_date it must be used together with the end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `end_date` | `string` query | `2021-04-16` | <!--source:api-specifications-->If provided, filters by end_date it must be used together with the start_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `date` | `string` query | `2021-04-16` | <!--source:api-specifications-->If provided, filters by date Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Items` | `object[]` | <!--source:api-specifications-->Items<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction Identifier<!--/source--> |
| `cost_in_cents` | `string` | <!--source:api-specifications-->cost<!--/source--> |
| `pages` | `string` | <!--source:api-specifications-->pages<!--/source--> |
| `partner` | `string` | <!--source:api-specifications-->partner<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->Creation date in timestamp format<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Name of the Product<!--/source--> |
| `document_type` | `string` | <!--source:api-specifications-->Type of the document<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response example
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `Error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Development
<!--/source-->

`POST` `/development-products`

<!--source:api-specifications-->

#### Mark as development env for specific product
<!--/source-->

`register_env`

<!--source:api-specifications-->
Mark this environment as development env for specific product, so failures for this product on this env will not affect Staircase status page.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "product_id": "ccd6b8dd-02a7-4c64-a983-7e0c108cd666",
 "is_disabled": true
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
text/html Copy 400 response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_id`required | `string` | <!--source:api-specifications-->The product id that we want to mark as development env.<!--/source-->Example `ccd6b8dd-02a7-4c64-a983-7e0c108cd666` |
| `is_disabled`required | `boolean` | <!--source:api-specifications-->If true, disable sending alerts for this product_id on this env.<!--/source-->Example `true` |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->The environment was configured successfully<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
400 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error in storing the environment invalid host<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Performance Metrics
<!--/source-->

`POST` `/metric/{transaction_id}`

<!--source:api-specifications-->

#### Create New Metric
<!--/source-->

`create_metric`

<!--source:api-specifications-->
Create New Metric.
<!--/source-->

<!--source:api-specifications-->
Registers a metric identified by a transaction_id or a unique identifier to track product performance, If multiple services in a product perform processing for the same transaction, the services should send their results to Create New Metric, enabling customers to see the result for one transaction between all products.

Create New Metric tracks the following metric types:

- Transaction: For every service endpoint invocation, a metric of this type is posted to Health providing information about the service, error, or relevant data to track.

Show the rest
- Logging: For every service endpoint invocation the logging metrics are posted to follow up the execution process in the source code and including relevant information to track an issue.

Health Metrics stores additional fields depending on the product family that allows tracking product KPIs.

Single Health Metric payload has 256 KB size limit.

Creating a new metric programmatically example:

```
import requests
from uuid import uuid4
import json
import boto3
client = boto3.client('dynamodb')
def create_metric(event, **kwargs):
transaction_id = str(uuid4)
request_host = event["headers"]["Host"]
service_url = request_host + event['path']
x_api_key = event['headers']['x-api-key']
logging_message = kwargs["logging_message"] if "logging_message" in kwargs else None
if "error" in kwargs and isinstance(kwargs['error'], dict):
payload = {
"host_environment": request_host,
"product_name": kwargs['product_name'],
"metric_type": kwargs['metric_type'],
"logging_message": logging_message, 
"method": kwargs['method'],
"service_endpoint": service_url,
"error": kwargs['error'], 
"data":
{ "status": kwargs['status_response']}
}
else:
payload = {
"host_environment": request_host,
"product_name": kwargs['product_name'],
"metric_type": kwargs['metric_type'],
"logging_message": logging_message, 
"method": kwargs['method'],
"service_endpoint": service_url,
"data":
{ "status": kwargs['status_response']}
}
requests.post(
f"",
headers={"x-api-key": x_api_key},
json=payload
)
@cors_headers
def lambda_handler(event, context):
try:
# Example doing something 
create_metric(event, product_name="test_example", metric_type="logging", "logging_message"="start handler" method="POST", status_response=200 )
item_example = {
"Enterprise": "Staircase",
"Phone":"1-347-563-5689",
}
response = client.put_item(
TableName='string',
Item=item_example
)
# Example create a successfully metric 
create_metric(event, product_name="test_example", metric_type="transaction", method="POST", status_response=200 )
# return function example 
return {
'statusCode': 200,
'body': json.dumps({'response': response })
}
except Exception as e:
# create metric error 
create_metric(event, product_name="test_example", error={
"status": 400,
"message": 'error',
"code": 42042}, metric_type="transaction", method="POST", status_response=200 )
# return function example 
return {
'statusCode': 400,
'body': json.dumps({'response': e })
}
```

<!--/source-->

##### Request

<!--source:api-specifications-->
MortgagePlatformDevops and other productsExample error metricExample logging metricExample failed logging metric
<!--/source-->

<!--source:api-specifications-->
application/json Copy Use HealthMetricInputV3 schema - An example of error report.

```
{
 "host_environment": "documentation.staircaseapi.com",
 "product_name": "employment",
 "service_endpoint": "/employment",
 "method": "POST",
 "metric_type": "transaction",
 "partner_name": "truework",
 "operation_status": "STARTED",
 "request_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Use HealthMetricInputV3 schema

```
{
 "host_environment": "documentation.staircaseapi.com",
 "product_name": "Connector",
 "service_endpoint": "/vendors/{vendor_name}/flows/{flow_name}/jobs",
 "method": "POST",
 "metric_type": "transaction",
 "partner_name": "truework",
 "request_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Use HealthMetricInputV3 schema -

```
{
 "host_environment": "documentation.staircaseapi.com",
 "product_name": "Code",
 "service_endpoint": "/clone",
 "method": "POST",
 "metric_type": "transaction",
 "operation_status": "IN PROGRESS",
 "data": {
 "project": "Health",
 "branch": "main"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Use HealthMetricInputV3 schema - An example of error report.

```
{
 "host_environment": "documentation.staircaseapi.com",
 "product_name": "Code",
 "service_endpoint": "/clone",
 "method": "POST",
 "metric_type": "transaction",
 "error": {
 "status": 500,
 "code": 42042,
 "message": "Internal server error",
 "more_info": "https://httpstatuses.com/500"
 },
 "data": {
 "project": "Health",
 "branch": "main"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Example using metric as logging in metric_type.

```
{
 "host_environment": "documentation.staircaseapi.com",
 "product_name": "Code",
 "service_endpoint": "/clone",
 "method": "POST",
 "metric_type": "logging",
 "logging_message": "Connect to Github",
 "elapsed_time": 200.27,
 "data": {
 "project": "Health",
 "branch": "main"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Example using metric as logging in metric_type.

```
{
 "host_environment": "documentation.staircaseapi.com",
 "product_name": "Code",
 "service_endpoint": "/clone",
 "method": "POST",
 "metric_type": "logging",
 "logging_message": "Connect to Github",
 "data": {
 "project": "Health",
 "branch": "main"
 },
 "error": {
 "status": 500,
 "code": 42042,
 "message": "Internal server error"
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html403500
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "message": "metrics created."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Failed Creation.

```
{
 "message": "Error in creating metric "
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Failed Creation.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Failed Creation.

```
{
 "message": "Internal server error"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |
| `transaction_id` required | `string` path | `3cd0ffab-6e87-40a8-bc84-697155131f4c` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
14 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_name`required | `string` | <!--source:api-specifications-->The system that is exposed externally to customers and performs the action. Examples Assess, Build, Employment.<!--/source-->Example `employment` |
| `host_environment` | `string` | <!--source:api-specifications-->Environment host where the product is deployed.<!--/source-->Example `documentation.staircaseapi.com` |
| `service_endpoint`required | `string` | <!--source:api-specifications-->The service endpoint URL that executed an operation, process, or function in the product. Endpoints with path parameters cannot be sent with real values, it must be sent as variables. Example /metric/%7Btransaction_id%7D and /metric are service endpoints of the Health product.<!--/source-->Example `/metric/%7Btransaction_id%7D` |
| `method` | `string` | <!--source:api-specifications-->HTTP's method or verb that indicates the service endpoint operation type.<!--/source-->`DELETE GET PATCH POST PUT`Example `POST` |
| `metric_type` | `string (string)` | <!--source:api-specifications-->The type of metric to create, valid options: logging | transaction<!--/source-->`logging``transaction`Example `logging` |
| `logging_message` | `string (string)` | <!--source:api-specifications-->This field is only available for logging metric_type. It is used for logging purpose.<!--/source-->Example `Get collection translation` |
| `data` | `object` | <!--source:api-specifications-->Receives a valid JSON with data fields the product wants to log to track issues faster.<!--/source--> |
| `request_collection_id` | `string (string)` | <!--source:api-specifications-->A request collection in Staircase is a container for the elements that a product needs to execute. For example, an AUS collection is a digital representation of a loan application, while a Data Extraction collection is a digital representation of a document.<!--/source-->Example `01F2MHXNNNVK02YEY63Q5EQ59T` |
| `response_collection_id` | `string (string)` | <!--source:api-specifications-->A response collection in Staircase is a container for the elements that a product has as an output for its execution.<!--/source-->Example `01F2MHXNNNVK02YEY63Q5EQ59T` |
| `partner_name` | `string` | <!--source:api-specifications-->The name of the data partner you will receive a product response from. Products that interact with partner integrations in the service endpoint operation should send this field.<!--/source-->Example `Atomic` |
| `severity` | `string` | <!--source:api-specifications-->The type of the severity to create metric.<!--/source-->`CRITICAL``DEBUG``ERROR``HIGH``INFO``LOW``MEDIUM``WARNING` |
| `operation_status` | `string` | <!--source:api-specifications-->Every single Staircase service endpoint (such as POST /persistence/transactions or POST /aus/underwrite) is required to provide operation status updates to denote the progress of a transaction in its execution. For more information see the Health overview page with examples.<!--/source-->`ABORTED``CANCELLED``COMPLETED``CREATED``EMAIL_CONFIRMED``ERROR``FAILED``IN PROGRESS``IN_PROGRESS``NOT_FOUND``REQUEST_MADE``RUNNING``STARTED``SUCCEEDED``SUCCEEDED_WITH_WARNING``TIMED_OUT``TIMEOUT``UNAUTHORIZED``WAITING_FOR_RESPONSE`Example `COMPLETED` |
| `elapsed_time` | `number` | <!--source:api-specifications-->The measured duration of an event. The time is expressed in seconds.<!--/source-->Example `120.27` |
| `error` | `object` | <!--source:api-specifications-->Receives a valid JSON with the fields to store the error or exception details that occurred during the operation execution. The metric is considered as failed when the error details are provided<!--/source--> |
| `status`required | `integer` | <!--source:api-specifications-->Status or error code that will be returned by the service<!--/source-->Example `401` |
| `code` | `integer` | <!--source:api-specifications-->Internal error codes.<!--/source-->Example `42042` |
| `message`required | `string` | <!--source:api-specifications-->Message of Status Code.<!--/source-->Example `Unauthorized` |
| `more_info` | `string` | <!--source:api-specifications-->Additional Information on Error<!--/source-->Example `https://api.staircase.co/docs/errors/42042` |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message the metric was successfully created<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Failed Creation.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message reason why the creation has failed<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Failed Creation.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message error<!--/source--> |

`GET` `/metric`

<!--source:api-specifications-->

#### Retrieve Metrics
<!--/source-->

`transactions_list`

<!--source:api-specifications-->
The service retrieves a list of metrics given one or multiple filters. To retrieve all results, send the request with the same query parameters and next_token provided on the previous call until next_token does not appear in the response.

The parameters must use URL Encoding for Special Characters ``` e.g. Left Curly Brace (“{”) = “%7B”, Right Curly Brace (“}”) = “%7D” ``` service_endpoint=%7Btransaction_id%7D

Example: service_endpoint=/metric/%7Btransaction_id%7D, for the service "/metric/%7Btransaction_id%7D"

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 application/json400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "Success response": {
 "value": {
 "next_token": "eyJwcm9kdWN0X25hbWUiOiAiQnVpbGQiLCAiY3JlYXRlZF9hdCI6ICIyMDIxLTA2LTA0VDE0OjU5OjE5LjU3MTg3OSJ9",
 "metrics": [
 {
 "created_at": "2021-07-07T14:17:28.991666-04:00",
 "product_name": "a",
 "status": "succeeded",
 "customer_api_key": "f5c4fec5-2159-4ca4-a061-ab8938ceb70d",
 "transaction_id": "11111111111111",
 "service_endpoint": "/bulg",
 "elapsed_time": "120.0",
 "service_name": "a"
 },
 {
 "request_collection_id": "a",
 "created_at": "2021-05-13T14:07:36.598931-04:00",
 "product_name": "aa",
 "status": "succeeded",
 "transaction_id": "KLKLKLKLKLKLKLKLKLKLKLKL",
 "service_endpoint": "",
 "service_name": "aa"
 }
 ]
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "response": {
 "value": {
 "message": "Filters not allowed ",
 "allowed filters": [
 "product_name",
 "status",
 "partner_name",
 "metric_type",
 "operation_stauts",
 "product_name and severity",
 "product_name and status",
 "operation_stauts and partner_name",
 "start_date and end_date can be combined with every filter"
 ]
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
15
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |
| `service_name` | `string` query | `/employment` | <!--source:api-specifications-->It will be consider as product_name, If provided, filters by concrete product name.<!--/source--> |
| `product_name` | `string` query | `employment` | <!--source:api-specifications-->If provided, filters by concrete product name.<!--/source--> |
| `criterion` | `string` query | `succeeded` | <!--source:api-specifications-->It will be consider status. Available values: failed, succeeded<!--/source--> |
| `status` | `string` query | `succeeded` | <!--source:api-specifications-->status. Available values: failed, succeeded<!--/source--> |
| `partner_name` | `string` query | `Atomic` | <!--source:api-specifications-->If provided, filters by partner_name<!--/source--> |
| `operation_status` | `string` query | `STARTED` | <!--source:api-specifications-->If provided, filters by operation_status<!--/source--> |
| `metric_type` | `string` query | `logging` | <!--source:api-specifications-->If provided, filters by metric_type<!--/source--> |
| `severity` | `string` query | `LOW` | <!--source:api-specifications-->If provided, filters by severity<!--/source--> |
| `start_date` | `string` query | `2021-04-13` | <!--source:api-specifications-->If provided, filters by start_date it must be used together with the end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `end_date` | `string` query | `2021-04-16` | <!--source:api-specifications-->If provided, filters by end_date it must be used together with the start_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `date` | `string` query | `2021-04-16` | <!--source:api-specifications-->If provided, filters by date Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `customer_api_key` | `string` query | `954913e2-db71-4f22-b71c-ef803915eb2b` | <!--source:api-specifications-->It is the key required in order to use the API. Filters by customer_api_key.<!--/source--> |
| `elapsed_time` | `string` query | `120.27` | <!--source:api-specifications-->The measured duration of an event. The time is expressed in seconds.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `next_token` | `string` | <!--source:api-specifications-->Pagination Token<!--/source--> |
| `metrics` | `object[]` | <!--source:api-specifications-->Metrics<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Environment host where the product is deployed.<!--/source--> |
| `service_endpoint` | `string` | <!--source:api-specifications-->The service endpoint URL that executed an operation, process, or function in the product. Endpoints with path parameters cannot be sent with real values, it must be sent as variables. Example /metric/%7Btransaction_id%7D and /metric are service endpoints of the Health product.<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->The system that is exposed externally to customers and performs the action. Examples Assess, Build, Employment.<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->A collection in Staircase is a container for the elements that a product needs to execute. For example, an AUS collection is a digital representation of a loan application, while a Data Extraction collection is a digital representation of a document.<!--/source--> |
| `operation_status` | `string` | <!--source:api-specifications-->The status of an operation given the nature of the actions performed by the service and the transaction result. The service endpoint operation could be successful but the transaction_id could have different status given certain conditions and other operations performed.<!--/source--> |
| `metric_type` | `string` | <!--source:api-specifications-->The type of metric options allowed logging | transaction<!--/source--> |
| `logging_message` | `string` | <!--source:api-specifications-->This field is only available for metric_type equals logging. It is used for logging purpose.<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source--> |
| `severity` | `string` | <!--source:api-specifications-->Severity e.g. (HIGH, MEDIUM, LOW)<!--/source-->`CRITICAL``DEBUG``ERROR``HIGH``INFO``LOW``MEDIUM``WARNING` |
| `customer_api_key` | `string` | <!--source:api-specifications-->It is the key required in order to use the API. Filters by customer_api_key.<!--/source--> |
| `partner_name` | `string` | <!--source:api-specifications-->The name of the data partner you will receive a product response from. Products that interact with partner integrations in the service endpoint operation should send this field.<!--/source--> |
| `elapsed_time` | `string` | <!--source:api-specifications-->The measured duration of an event. The time is expressed in seconds.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`GET` `/metric/{transaction_id}`

<!--source:api-specifications-->

#### Retrieve Metrics by Transaction ID
<!--/source-->

`get_metrics`

<!--source:api-specifications-->
Retrieve Metrics by transaction_id
<!--/source-->

<!--source:api-specifications-->
Retrieve all health reports for specified transaction_id

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 application/json400 text/html403500
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "Success Response": {
 "metrics": [
 {
 "host_environment": "health.staircaseapi.com",
 "created_at": "2021-07-02T14:52:18.657665-04:00",
 "product_name": "Health",
 "data": {
 "request_data": "9384b4ac-9ea5-4926-824c-eefe37d9689c"
 },
 "status": "succeeded",
 "customer_api_key": "954913e2-db71-4f22-b71c-ef803915eb2b",
 "transaction_id": "9384b4ac-9ea5-4926-824c-eefe37d9689c",
 "metric_type": "transaction",
 "method": "GET",
 "service_endpoint": "/metric"
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "message": "Error in metric retrieving"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error while retrieving metrics.

```
{
 "message": "Internal server error"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
8
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |
| `transaction_id` required | `string (uuid)` path | `3cd0ffab-6e87-40a8-bc84-697155131f4c` | <!--source:api-specifications-->An Identifier for a Transaction in Staircase.<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `product_name` | `string` query | `Code` | <!--source:api-specifications-->filters by concrete product name.<!--/source--> |
| `host_environment` | `string` query | `health.staircaseapi.com` | <!--source:api-specifications-->filters by host environment.<!--/source--> |
| `status` | `string` query | `succeeded` | <!--source:api-specifications-->filters by status. Available values: failed, succeeded<!--/source--> |
| `service_endpoint` | `string` query | `/transactions` | <!--source:api-specifications-->filters by service endpoint<!--/source--> |
| `method` | `string` query | `GET` | <!--source:api-specifications-->filters by Http Methods. Available values DELETE GET PATCH POST PUT<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `metrics` | `object[]` | <!--source:api-specifications-->Response Body<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Environment host where the product is deployed.<!--/source--> |
| `service_endpoint` | `string` | <!--source:api-specifications-->The service endpoint URL that executed an operation, process, or function in the product. Endpoints with path parameters cannot be sent with real values, it must be sent as variables. Example /metric/%7Btransaction_id%7D and /metric are service endpoints of the Health product.<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->The system that is exposed externally to customers and performs the action. Examples Assess, Build, Employment.<!--/source--> |
| `metric_type` | `string` | <!--source:api-specifications-->The type of metric options allowed logging | transaction<!--/source--> |
| `logging_message` | `string` | <!--source:api-specifications-->This field is only available for metric_type logging. It is used for logging purpose.<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->A collection in Staircase is a container for the elements that a product needs to execute. For example, an AUS collection is a digital representation of a loan application, while a Data Extraction collection is a digital representation of a document.<!--/source--> |
| `operation_status` | `string` | <!--source:api-specifications-->The status of an operation given the nature of the actions performed by the service and the transaction result. The service endpoint operation could be successful but the transaction_id could have different status given certain conditions and other operations performed.<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source--> |
| `severity` | `string` | <!--source:api-specifications-->Severity e.g. (HIGH, MEDIUM, LOW)<!--/source-->`CRITICAL``DEBUG``ERROR``HIGH``INFO``LOW``MEDIUM``WARNING` |
| `customer_api_key` | `string` | <!--source:api-specifications-->It is the key required in order to use the API. Filters by customer_api_key.<!--/source--> |
| `partner_name` | `string` | <!--source:api-specifications-->The name of the data partner you will receive a product response from. Products that interact with partner integrations in the service endpoint operation should send this field.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error while retrieving metrics.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Response Body<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Health Metrics
<!--/source-->

`POST` `/metrics`

<!--source:api-specifications-->

#### Create Health Metric
<!--/source-->

`create_health_metric`

<!--source:api-specifications-->
Create New Health Metric.
<!--/source-->

<!--source:api-specifications-->

#### Health Metric

##### Product Identifier

A product is an entity in the ontology. Product identifiers can be retrieved from Marketplace after product registration. Please visit Marketplace for product registration.

##### Product Api Identifier

API can be referenced by unique ID under products. Please visit Marketplace for API registration.

##### Transaction ID

Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.

Show the rest

##### Response Collection ID

A response collection in Staircase is a container for the elements that a product has as an output for its execution. Combination of transaction ID and response collection ID uniquely identifies an execution.

##### Status

| Status | Description |
| --- | --- |
| REQUEST_MADE | Request received successful by API. |
| IN_PROGRESS | Invocation has not reached a final state. |
| SUCCEEDED | Invocation finished successfully. |
| FAILED | Invocation was not successful. |

##### Elapsed Time

Amount of time that passes between the beginning of the request and the end of the invocation.

##### Invocation Code

The invocation code provides information for the invocation response. Codes and descriptions are given below. Please raise CR if needed invocation code is not listed here.

| Invocation Code | Description |
| --- | --- |
| 2000 | OK. Invocation is successful |
| 4000 | BAD_REQUEST. The server cannot or will not process the request due to something that is perceived to be a client error. |
| 4001 | UNAUTHORIZED. The client is not authenticated to get the requested response. |
| 4003 | FORBIDDEN. The client is known but has no access rights to the content. |
| 4004 | NOT_FOUND. The server can not find the requested resource. |
| 4009 | CONFLICT. The request could not be completed due to a conflict with the current state of the target resource. |
| 4013 | PAYLOAD_TOO_LARGE. The request entity is larger than the limits defined by the server. |
| 4022 | UNPROCESSABLE_ENTITY. The request was well-formed but was unable to be followed due to semantic errors. |
| 4029 | TOO_MANY_REQUEST. The user has sent too many requests in a given amount of time. |
| 5000 | INTERNAL_SERVER_ERROR. The server has encountered a situation it does not know how to handle. |
| 5004 | TIMEOUT. This error response is given when the server cannot get a response in time. |
| 6000 | PARTNER_CALL_SUCCESS. Partner invocation returns a successful response. |
| 6001 | PARTNER_CALL_ERROR_INVALID_AUTH. Unauthorized partner call. |
| 6002 | PARTNER_CALL_ERROR_TIMEOUT. The partner did give the response in the given time. |
| 6003 | PARTNER_CALL_ERROR_TOO_MANY_REQUESTS. Partner called too many times in the amount of time that partner defined. |
| 6004 | PARTNER_CALL_ERROR_INVALID_PAYLOAD. Provided payload to the partner is invalid. |
| 6005 | PARTNER_CALL_ERROR_SERVICE_ERROR. Partner returns generic/unclassified service error. |
| 6006 | PARTNER_CALL_ERROR_NOT_FOUND The server cannot find the requested resource. |
| 6007 | PARTNER_CALL_ERROR_CONFLICT This response is sent when a request conflicts with the current state of the server. |
| 7000 | COLD_START. The server received the request successfully but had an initialization process before working on the client request. |
| 7001 | INTERNAL_OPERATION_THRESHOLD_EXCEEDED. The server could not finish the internal operation at the given threshold. The threshold can be duration, coverage, etc. |
| 7002 | INTERNAL_OPERATION_FAILED. The server completed transaction but had failure in the internal operation. |
| 7003 | OVERHEAD. Metric for measuring overhead on given service. |
| 8000 | SITE_SESSION_INITIATED. Metric for measuring Site Sessions. |
| 8001 | SITE_PAGE_CHANGED. Metric for measuring Site page changes. |
| 8002 | CONSOLE_APP_LOADED. Metric for measuring Console App loads. |
| 8003 | CONSOLE_APP_USED_DATA. Metric for calculating if Console App used prepopulated data. |
| 9001 | EMAIL_SEND. Email send. The send request was successful and the email provider will attempt to deliver the message to the recipient’s mail server. |
| 9002 | EMAIL_DELIVERY. Email delivery. The email provider successfully delivered the email to the recipient’s mail server. |
| 9003 | EMAIL_OPEN. Email open. The recipient received the message and opened it in their email client. |
| 9004 | EMAIL_CLICK. The recipient clicked one or more links in the email. |
| 9400 | EMAIL_DELIVERY_DELAY. The email couldn’t be delivered to the recipient’s mail server because a temporary issue occurred. |
| 9401 | EMAIL_UNSUBSCRIBE. The email was successfully delivered, but the recipient updated their subscription preferences by clicking on an unsubscribe link. |
| 9403 | EMAIL_COMPLAINT. The email was successfully delivered to the recipient’s mail server, but the recipient marked it as spam. |
| 9500 | EMAIL_REJECT. The email provider accepted the email but determined that it contained a virus and didn’t attempt to deliver it to the recipient’s mail server. |
| 9501 | EMAIL_BOUNCE. The recipient’s mail server permanently rejected the email. |
| 9502 | EMAIL_RENDERING_FAILURE. The email wasn’t sent because of a template rendering issue. |

##### Product Build Hash

The builder generates a hash value after every product build. The hash value indicates which build version the metric comes from. Please check Builder documentation for details and how to get the build hash.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy An example health metric.

```
{
 "product_identifier": "ccd6b8dd-02a7-4c64-a983-7e0c108cd666",
 "product_api_identifier": "1236b8dd-02a7-4c64-a983-7e0c108cd666",
 "transaction_id": "01F2Q6WJXF5DK3ERTZ18JHSNE8",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "invocation_code": "6001",
 "status": "FAILED",
 "elapsed_time": 200.27
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "id": "86a9ef39-5907-4fb6-bdc5-987017b6c999",
 "message": "metrics created."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Failed Creation.

```
{
 "message": "Error in creating metric "
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Failed Creation.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `x-sc-trace-id` | `string` header | `041fe98-4005-438d-9e14-5849ed8d6cc6` | <!--source:api-specifications-->Id to trace all transactions related. It will be generated automatically if not provided.<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
20 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_identifier`required | `string` | <!--source:api-specifications-->Unique product identifier.<!--/source-->Example `ccd6b8dd-02a7-4c64-a983-7e0c108cd666` |
| `product_api_identifier`required | `string` | <!--source:api-specifications-->Unique product api identifier<!--/source-->Example `548070b4-6ea7-459e-9746-5020446b3a73` |
| `transaction_id`required | `string` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source-->Example `3cd0ffa-6e87-40a8-bc84-697155131f4c` |
| `response_collection_id`required | `string (string)` | <!--source:api-specifications-->A response collection in Staircase is a container for the elements that a product has as an output for its execution. Combination of transaction ID and response collection ID uniquely identifies a single execution.<!--/source-->Example `01F2MHXNNNVK02YEY63Q5EQ59T` |
| `status`required | `string` | <!--source:api-specifications-->Indicates status of the process.<!--/source-->`FAILED``IN_PROGRESS``REQUEST_MADE``SUCCEEDED`Example `SUCCEEDED` |
| `elapsed_time`required | `number` | <!--source:api-specifications-->The measured duration of an event. The time is expressed in seconds.<!--/source-->Example `120.27` |
| `invocation_code`required | `string` | <!--source:api-specifications-->Product invocation response code. For more information please check invocation code mapping.<!--/source-->Example `6001` |
| `configuration_id` | `string` | <!--source:api-specifications-->Product configuration ID.<!--/source--> |
| `product_build_hash` | `string` | <!--source:api-specifications-->Hash value that generated from builder.<!--/source--> |
| `campaign_id` | `string` | <!--source:api-specifications-->Campaign ID<!--/source--> |
| `user_agent` | `string` | <!--source:api-specifications-->Optional. Represents actor's user agent. This will not be derived from the request headers if omitted.<!--/source-->Example `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3` |
| `person_guid` | `string` | <!--source:api-specifications-->Person GUID<!--/source--> |
| `phone_call_callback_number` | `string` | <!--source:api-specifications-->Callback number<!--/source--> |
| `virtual_phone_number` | `string` | <!--source:api-specifications-->To phone number<!--/source--> |
| `communication_identifier` | `string` | <!--source:api-specifications-->From phone number<!--/source--> |
| `call_center_number` | `string` | <!--source:api-specifications-->Call center number<!--/source--> |
| `lead_identifier` | `string` | <!--source:api-specifications-->Lead identifier<!--/source--> |
| `voice_transcription` | `string` | <!--source:api-specifications-->The text representation of the spoken audio, transcribed from voice input.<!--/source--> |
| `sms_text` | `string` | <!--source:api-specifications-->The SMS text that we received.<!--/source--> |
| `x-sc-trace-id` | `string` | <!--source:api-specifications-->Id to trace all transactions related. It will be generated automatically if not provided.<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | <!--source:api-specifications-->Unique metric id.<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message the metric was successfully created<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Failed Creation.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message reason why the creation has failed<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

`POST` `/metrics/query`

<!--source:api-specifications-->

#### Create Asynchronous Health Metric Query
<!--/source-->

`create_async_health_query_execution`

<!--source:api-specifications-->
Create Asynchronous Health Query Execution
<!--/source-->

<!--source:api-specifications-->

#### Query Execution

Create Asynchronous Health Metric Query creates and executes the query immediately, for the query status and results invoke Get Asynchronous Health Metric Query Result. If you invoke multiple times Get Asynchronous Health Metric Query Result for the same query_id you will receive the same results set that was created during the (first) execution. Each execution of Create Asynchronous Health Metric Query creates a new query and result set.

#### Limits

| Limit | Value |
| --- | --- |
| Concurrent Query Execution | 20 query execution per second |

#### Timezone

The Health product uses the timezone Eastern Standard Time (UTC-5). Please specify the `include_timezone` field in the query configuration to get time with timezone information included.

<!--/source-->

##### Request

<!--source:api-specifications-->
Query BodyQuery Body List Fields
<!--/source-->

<!--source:api-specifications-->
application/json Copy Create asynchronous query execution

```
{
 "transaction_id": "01F2Q6WJXF5DK3ERTZ18JHSNE8",
 "start_date": "2022-04-11T00:00:00",
 "end_date": "2022-04-11T23:59:59"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Create asynchronous query execution

```
{
 "start_date": "2022-04-11T00:00:00",
 "end_date": "2022-04-11T23:59:59",
 "product_identifier": "ccd6b8dd-02a7-4c64-a983-7e0c108cd666",
 "invocation_codes": [
 7000,
 7001
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "query_id": "c62a1228-fae7-44c8-aebe-8706ecfb9fc4",
 "status": "PENDING"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Failed Creation.

```
{
 "message": "Error in creating metric "
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Failed Creation.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
22 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product_identifier` | `one of` | <!--source:api-specifications-->Product identifier<!--/source--> |
| `product_api_identifier` | `one of` | <!--source:api-specifications-->Product api identifier<!--/source--> |
| `transaction_id` | `one of` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source--> |
| `response_collection_id` | `one of` | <!--source:api-specifications-->A response collection in Staircase is a container for the elements that a product has as an output for its execution. Combination of transaction ID and response collection ID uniquely identifies a single execution.<!--/source--> |
| `invocation_code` | `one of` | <!--source:api-specifications-->Code that indicates invocation response<!--/source--> |
| `status` | `one of` | <!--source:api-specifications-->Indicates status of the process.<!--/source--> |
| `configuration_id` | `one of` | <!--source:api-specifications-->Product configuration ID.<!--/source--> |
| `product_build_hash` | `one of` | <!--source:api-specifications-->Hash value that generated from builder.<!--/source--> |
| `campaign_id` | `one of` | <!--source:api-specifications-->campaign_id from metric body.<!--/source--> |
| `user_agent` | `one of` | <!--source:api-specifications-->user_agent from metric body.<!--/source--> |
| `person_guid` | `one of` | <!--source:api-specifications-->person_guid from metric body.<!--/source--> |
| `phone_call_callback_number` | `one of` | <!--source:api-specifications-->callback number from metric body.<!--/source--> |
| `virtual_phone_number` | `one of` | <!--source:api-specifications-->virtual_phone_number number from metric body.<!--/source--> |
| `call_center_number` | `one of` | <!--source:api-specifications-->call_center_number number from metric body.<!--/source--> |
| `lead_identifier` | `one of` | <!--source:api-specifications-->lead_identifier from metric body.<!--/source--> |
| `communication_identifier` | `one of` | <!--source:api-specifications-->phone number from metric body.<!--/source--> |
| `voice_transcription` | `one of` | <!--source:api-specifications-->The text representation of the spoken audio, transcribed from voice input.<!--/source--> |
| `query_configuration` | `object` | <!--source:api-specifications-->Query configuration<!--/source--> |
| `include_timezone` | `boolean` | <!--source:api-specifications-->Includes timezone info and update date format to ISO8601.<!--/source--> |
| `include_host_environment` | `boolean` | <!--source:api-specifications-->Includes environment domain info to result set.<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->When query execution is done, this url will be called with result<!--/source-->Example `https://webhook.com/callback` |
| `start_date`required | `string` | <!--source:api-specifications-->Datetime must be in ISO8601 format.<!--/source-->Example `2021-08-13T00:00:00` |
| `end_date`required | `string` | <!--source:api-specifications-->Datetime must be in ISO8601 format. Should be later than `start_date`<!--/source-->Example `2021-08-13T23:59:59` |
| `x-sc-trace-id` | `string` | <!--source:api-specifications-->Id to trace all transactions related.<!--/source-->Example `041fe98-4005-438d-9e14-5849ed8d6cc6` |

##### Response `201``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `query_id` | `string` | <!--source:api-specifications-->Unique identifier for running query execution<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Status of the query execution<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Failed Creation.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message reason why the creation has failed<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

`GET` `/metrics/query/{query_id}`

<!--source:api-specifications-->

#### Get Asynchronous Health Metric Query Result
<!--/source-->

`get_async_health_query_result`

<!--source:api-specifications-->
The service retrieves a list of metrics by given query id. To retrieve all results, send the next_token provided on the previous call until next_token does not appear in the response.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 application/json400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "status": "SUCCEEDED",
 "result_csv_file": "https://athena-query-results-293107503335.s3.amazonaws.com/1cf6527c-95cc-4998-b273-d3f4b9dd8014.csv&Expires=1661502173",
 "next_token": "QVdzd01lM0VwNUNSUjNjakRRMllkNDBEdi92ZWZ6ODJXNFBGZnAxMmk4QjhlcTUrQ2tVaTFIZGpOSXRyYThUYU9YRHVHRzlzN3cxMXEwZTUzY3ZETGxOVHZQOWkwSFYzTUE9PQ==",
 "metrics": [
 {
 "created_at": "2022-08-26 02:34:46",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-1",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:34:49",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-2",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:34:52",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-3",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:34:55",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-4",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:34:58",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-5",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:35:02",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-6",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:35:05",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-7",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:35:08",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-8",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 },
 {
 "created_at": "2022-08-26 02:35:12",
 "host_environment": "health.staircaseapi.com",
 "product_identifier": "product_identifier_1",
 "product_api_identifier": "product_api_identifier_1",
 "transaction_id": "test-9",
 "response_collection_id": "01F2Q6WJXF5DK3ERTZ1E9NDNE8",
 "elapsed_time": 200.27,
 "status": "IN_PROGRESS",
 "invocation_code": "2000"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "message": "Bad Request"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `query_id` required | `string` path | `1fc23e2-b13e-405a-a3de-a5228950e3b8` | <!--source:api-specifications-->Unique query execution id<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `limit` | `integer` query | `150` | <!--source:api-specifications-->The number of results to return in this request.<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `query_id` required | `string` path | `query_id_1` | <!--source:api-specifications-->Query ID received previously with asynchronous query creation<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `status` | `string` | <!--source:api-specifications-->Status of the query execution<!--/source-->`FAILED``IN_PROGRESS``SUCCEEDED`Example `SUCCEEDED` |
| `result_csv_file` | `string` | <!--source:api-specifications-->Url for query result in CSV format<!--/source-->Example `https://athena-query-results-293107503335.s3.amazonaws.com/1cf6527c-95cc-4998-b273-d3f4b9dd8014.csv?%2Fol&Expires=1661502173` |
| `next_token` | `string` | <!--source:api-specifications-->Indicates next page exist. Using this token next page can retrieve.<!--/source-->Example `QVdMejZQT0gzY1I5ZmZCOXF2V1NlQW1Za2xITTNRYWtiVFViRUswYUVScWk2ZFJ3Q0xRRFFaQkx0QXVNVlU3K0JvZU8yTDIzc0RCSGNlcGg0TE5ZdExIeWJNeDlidDBSNkE9PQ==` |
| `metrics` | `object[]` | <!--source:api-specifications-->Metrics<!--/source--> |
| `id` | `string` | <!--source:api-specifications-->Metric unique identifier<!--/source-->Example `babb5fb4-b587-4914-a84c-c52c431b7905` |
| `created_at` | `string` | <!--source:api-specifications-->Metric creation date.<!--/source-->Example `2022-08-26 02:34:46` |
| `host_environment` | `string` | <!--source:api-specifications-->Environment host where the product is deployed.<!--/source-->Example `health.staircaseapi.com` |
| `product_identifier` | `string` | <!--source:api-specifications-->Unique product identifier.<!--/source-->Example `ccd6b8dd-02a7-4c64-a983-7e0c108cd666` |
| `product_api_identifier` | `string` | <!--source:api-specifications-->Unique product api identifier.<!--/source-->Example `548070b4-6ea7-459e-9746-5020446b3a73` |
| `transaction_id` | `string` | <!--source:api-specifications-->Transactions in Staircase are containers for all the data related to an instance of a transaction type. They enable you to correlate the output of various products to a single transaction type, where the transaction type depends on your line of business. A transaction_id, when used properly, gives you a holistic view of the data related to the transaction you’ve assembled.<!--/source-->Example `3cd0ffa-6e87-40a8-bc84-697155131f4c` |
| `response_collection_id` | `string` | <!--source:api-specifications-->A response collection in Staircase is a container for the elements that a product has as an output for its execution. Combination of transaction ID and response collection ID uniquely identifies a single execution.<!--/source-->Example `01F2MHXNNNVK02YEY63Q5EQ59T` |
| `elapsed_time` | `number` | <!--source:api-specifications-->The measured duration of an event. The time is expressed in seconds.<!--/source-->Example `14.55` |
| `status` | `string` | <!--source:api-specifications-->Indicates status of the process.<!--/source-->Example `IN_PROGRESS` |
| `invocation_code` | `string` | <!--source:api-specifications-->Product invocation response code.<!--/source-->Example `2000` |
| `configuration_id` | `string` | <!--source:api-specifications-->Product configuration ID.<!--/source-->Example `e1b96c6d-d24e-459c-ae8a-ec460df3de8f` |
| `product_build_hash` | `string` | <!--source:api-specifications-->Product build hash.<!--/source-->Example `46b5218a58aed835e63a3b7bf158742600dfbf10` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Aggregation[new]
<!--/source-->

`POST` `/metrics/aggregation/query`

<!--source:api-specifications-->

#### Aggregate Health Metrics[new]
<!--/source-->

`aggregate_health_metrics`

<!--source:api-specifications-->
Aggregate Health Metrics
<!--/source-->

<!--source:api-specifications-->
The service creates aggregated metric query execution for the given query parameters.

#### Aggregation

##### Date

If specified, fillers data between the given start and end date and group them according to the given date interval.

###### Interval

Allowed interval types:

- `second`
- `minute`
- `hour`
- `day`

##### Filters

Multiple filters that applied before grouping metrics. Filter condition applied according to the given operator onto the given field.

Show the rest

| Allowed Operator | Allowed Field |
| --- | --- |
| `=` | `product_identifier`, `product_api_identifier`, `transaction_id`, `response_collection_id` , `status`, `invocation_code`, `configuration_id`, `product_build_hash` |

##### Group By

Group values with a given field. Allowed field names:

- `product_identifier`
- `product_api_identifier`
- `transaction_id`
- `response_collection_id`
- `status`
- `invocation_code`
- `configuration_id`
- `product_build_hash`

##### Methods

Allows applying methods on filtered and grouped results. Methods are defined and applicable according to filed names. `row` is a special keyword for representing a single row in the result set.

| Allowed Method | Allowed field |
| --- | --- |
| `COUNT` | `row`, `product_identifier`, `product_api_identifier`, `transaction_id`, `response_collection_id` , `status`, `invocation_code`, `elapsed_time`, `configuration_id`, `product_build_hash` |
| `SUM` | `elapsed_time` |
| `AVG` | `elapsed_time` |
| `P50, P90, P95, P99` | `elapsed_time` |

##### Limits

| Limit | Value |
| --- | --- |
| Concurrent Aggregation Execution | 20 query execution per second |

<!--/source-->

##### Request

<!--source:api-specifications-->
Product APIs Hourly Status Distribution Product APIs Hourly Avg Elapsed times
<!--/source-->

<!--source:api-specifications-->
application/json Copy Create asynchronous query execution

```
{
 "date": {
 "start_date": "2022-10-03T00:00:00",
 "end_date": "2022-10-10T23:59:59",
 "interval": {
 "type": "hour",
 "value": "1"
 }
 },
 "filters": [
 {
 "field_name": "product_identifier",
 "field_value": "e53e749f-38ec-4435-943f-6d5c6d32bc12",
 "operator": "="
 }
 ],
 "group_by": [
 "product_identifier",
 "product_api_identifier",
 "status"
 ],
 "methods": [
 {
 "method_name": "COUNT",
 "field_name": "row"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Create asynchronous query execution

```
{
 "date": {
 "start_date": "2022-10-03T00:00:00",
 "end_date": "2022-10-10T23:59:59",
 "interval": {
 "type": "hour",
 "value": "1"
 }
 },
 "filters": [
 {
 "field_name": "product_identifier",
 "field_value": "e53e749f-38ec-4435-943f-6d5c6d32bc12",
 "operator": "="
 }
 ],
 "group_by": [
 "product_identifier",
 "product_api_identifier"
 ],
 "methods": [
 {
 "method_name": "AVG",
 "field_name": "elapsed_time"
 }
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "query_id": "c62a1228-fae7-44c8-aebe-8706ecfb9fc4",
 "status": "IN_PROGRESS"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Failed Creation.

```
{
 "message": "Error in creating metric "
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Failed Creation.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
6 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `date`required | `object` | <!--source:api-specifications-->Date filter and interval specification<!--/source--> |
| `start_date`required | `string` | <!--source:api-specifications-->If provided, filters by start_date it must be used together with the end_date. Date must be in ISO8601 format.<!--/source-->Example `2021-08-13T00:00:00` |
| `end_date`required | `string` | <!--source:api-specifications-->If provided, filters by end_date it must be used together with the start_date. Date must be in ISO8601 format.<!--/source-->Example `2021-08-13T23:59:59` |
| `interval` | `object` | <!--source:api-specifications-->Date interval<!--/source--> |
| `type`required | `string` | <!--source:api-specifications-->Interval type<!--/source-->`day``hour``minute``second`Example `minute` |
| `value`required | `integer` | <!--source:api-specifications-->Interval value<!--/source-->Example `1` |
| `filters` | `object[]` | <!--source:api-specifications-->List of filters<!--/source--> |
| `field_name`required | `string` | <!--source:api-specifications-->Filter field name<!--/source-->`configuration_id``invocation_code``product_api_identifier``product_build_hash``product_identifier``response_collection_id``status``transaction_id`Example `status` |
| `field_value`required | `string` | <!--source:api-specifications-->Filter field value<!--/source-->Example `FAILED` |
| `operator`required | `string` | <!--source:api-specifications-->The operator that will be used for comparison<!--/source-->`=` |
| `group_by`required | `string[]` | <!--source:api-specifications-->Field names that will be used for grouping<!--/source--> |
| `methods` | `object[]` | <!--source:api-specifications-->Methods that will be applied to grouped metrics<!--/source--> |
| `method_name`required | `string` | <!--source:api-specifications-->Method name<!--/source-->`AVG``COUNT``SUM`Example `COUNT` |
| `field_name`required | `string` | <!--source:api-specifications-->Field name<!--/source-->`configuration_id``elapsed_time``invocation_code``product_api_identifier``product_build_hash``product_identifier``response_collection_id``row``status``transaction_id`Example `row` |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->When query execution is done, this url will be called with result<!--/source-->Example `https://webhook.com/callback` |
| `query_configuration` | `object` | <!--source:api-specifications-->Query configuration<!--/source--> |
| `include_timezone` | `boolean` | <!--source:api-specifications-->Includes timezone info and update date format to ISO8601.<!--/source--> |
| `include_host_environment` | `boolean` | <!--source:api-specifications-->Includes environment domain info to result set.<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `query_id` | `string` | <!--source:api-specifications-->Unique identifier for running query execution<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Status of the query execution<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Failed Creation.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message reason why the creation has failed<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

`GET` `/metrics/aggregation/query/{query_id}`

<!--source:api-specifications-->

#### Get Health Aggregation Query Result[new]
<!--/source-->

`get_aggregated_health_query_result`

<!--source:api-specifications-->
Get Health Aggregation Query Result
<!--/source-->

<!--source:api-specifications-->
The service retrieves aggregated metric query result. To retrieve all results, send the next_token provided on the previous call until next_token does not appear in the response.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 application/json400 text/html404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "status": "SUCCEEDED",
 "result_csv_file": "https://athena-query-results-1111111111.s3.amazonaws.com/2ff0bc1e-c48e-438a-b82b-418d2d844f0a.csv?&Expires=1665390635",
 "metrics": [
 {
 "time_interval": "2022-10-05 00:00:00",
 "product_identifier": "e53e749f-38ec-4435-943f-6d5c6d32bc12",
 "product_api_identifier": "087dc8c8-936c-4148-82f6-7f8fe112d48c",
 "elapsed_time_avg": 0.0018733719
 },
 {
 "time_interval": "2022-10-07 00:00:00",
 "product_identifier": "e53e749f-38ec-4435-943f-6d5c6d32bc12",
 "product_api_identifier": "087dc8c8-936c-4148-82f6-7f8fe112d48c",
 "elapsed_time_avg": 0.00072799996
 },
 {
 "time_interval": "2022-10-06 00:00:00",
 "product_identifier": "e53e749f-38ec-4435-943f-6d5c6d32bc12",
 "product_api_identifier": "087dc8c8-936c-4148-82f6-7f8fe112d48c",
 "elapsed_time_avg": 0.0010120743
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response.

```
{
 "message": "Bad Request"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
5
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` required | `string` header | `01GYYMHV78DVPV5TSHPQTJ31X9` | <!--source:api-specifications-->Trace ID<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `limit` | `integer` query | `150` | <!--source:api-specifications-->The number of results to return in this request.<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `query_id` required | `string` path | `query_id_1` | <!--source:api-specifications-->Query ID received previously with asynchronous query creation<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `status` | `string` | <!--source:api-specifications-->Status of the query execution<!--/source-->`FAILED``IN_PROGRESS``SUCCEEDED`Example `SUCCEEDED` |
| `result_csv_file` | `string` | <!--source:api-specifications-->Url for query result in CSV format<!--/source-->Example `https://athena-query-results-293107503335.s3.amazonaws.com/1cf6527c-95cc-4998-b273-d3f4b9dd8014.csv?%2Fol&Expires=1661502173` |
| `next_token` | `string` | <!--source:api-specifications-->Indicates next page exist. Using this token next page can retrieve.<!--/source-->Example `QVdMejZQT0gzY1I5ZmZCOXF2V1NlQW1Za2xITTNRYWtiVFViRUswYUVScWk2ZFJ3Q0xRRFFaQkx0QXVNVlU3K0JvZU8yTDIzc0RCSGNlcGg0TE5ZdExIeWJNeDlidDBSNkE9PQ==` |
| `metrics` | `object[]` | <!--source:api-specifications-->Metrics<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Custom Metric Types
<!--/source-->

`POST` `/post-metric`

<!--source:api-specifications-->

#### Create Custom Metrics
<!--/source-->

`post_custom_metric`

<!--source:api-specifications-->
Create custom metric for a specific metric type.
<!--/source-->

<!--source:api-specifications-->
Create custom metric for a specific metric type

<!--/source-->

##### Request

<!--source:api-specifications-->
012
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "metric_type": "test_27",
 "name": "simnlol",
 "address": "formiga112",
 "product": {
 "place": "luzitania",
 "sin": "rep_24"
 },
 "techno": [
 69,
 21,
 12,
 24
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "metric_type": "test_nnn",
 "name": "simnlol",
 "address": "formiga112",
 "product": {
 "place": "luzitania",
 "sin": "rep_24"
 },
 "techno": [
 69,
 21,
 12,
 24
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "metric_type": "test_27",
 "name": "simnlol",
 "address": "formiga112",
 "product": {
 "place": "nono",
 "sin": "rep_24"
 },
 "techno": [
 69,
 21,
 12,
 24
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 0400 1400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Created Response

```
{
 "resp": "metric sent"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response

```
{
 "error": "metric_type test_nnn does not exist "
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response

```
{
 "error": "123 is not of type 'string'\n\nFailed validating 'type' in schema['properties']['product']['properties']['place']:\n {'type': 'string'}\n\nOn instance['product']['place']:\n 123"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `product` | `object` | <!--source:api-specifications-->Metric object<!--/source--> |
| `sin` | `string` | <!--source:api-specifications-->Metric field example<!--/source--> |
| `place` | `string` | <!--source:api-specifications-->Metric field example<!--/source--> |
| `address` | `string` | <!--source:api-specifications-->Metric field example<!--/source--> |
| `techno` | `integer[]` | <!--source:api-specifications-->Metric field example<!--/source--> |
| `metric_type`required | `string` | <!--source:api-specifications-->Metric field example<!--/source--> |
| `name` | `string` | <!--source:api-specifications-->Metric field example<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Created Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `resp` | `string` | <!--source:api-specifications-->Response<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error Response<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`PUT` `/put-metric-type`

<!--source:api-specifications-->

#### Update Metric Type
<!--/source-->

`update_metric_type`

<!--source:api-specifications-->
This service update an existing metric type and its fields, allowing the customer to update their own metrics based on events when a metric is posted to the Health.
<!--/source-->

<!--source:api-specifications-->
This service update an existing metric type and its fields, allowing the customer to update their own metrics based on events when a metric is posted to the Health. This service update an existing metric type and its fields, allowing the customer to update their own metrics based on events when a metric is posted to the Health /post-metric service.

The metric type name is the main reference. The field names can be reference to build a new report.

<!--/source-->

##### Request

<!--source:api-specifications-->
01
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "metric_type_name": "test_000",
 "schema": {
 "type": "object",
 "required": [],
 "properties": {
 "name": {
 "type": "string"
 },
 "address": {
 "type": "string"
 },
 "product": {
 "type": "object",
 "properties": {
 "place": {
 "type": "string"
 },
 "sin": {
 "type": "string"
 }
 }
 },
 "techno": {
 "type": "array",
 "items": {
 "type": "number"
 }
 }
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "schema": {
 "type": "object",
 "required": [],
 "properties": {
 "name": {
 "type": "string"
 },
 "address": {
 "type": "string"
 },
 "product": {
 "type": "object",
 "properties": {
 "place": {
 "type": "string"
 },
 "sin": {
 "type": "string"
 }
 }
 },
 "techno": {
 "type": "array",
 "items": {
 "type": "number"
 }
 }
 }
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 0400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Metric type created response

```
{
 "message": "the metric_type was successfully updated"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "error": "error updating metric type: metric_type_name is a required field "
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->Key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `schema` | `object` | <!--source:api-specifications-->The metric type schema<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Type declaration example<!--/source--> |
| `required` | `string[]` | <!--source:api-specifications-->Required array. All the field which are required in the schema<!--/source--> |
| `properties` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `product` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `properties` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `address` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `techno` | `object` | <!--source:api-specifications-->Example Array Field<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `items` | `object` | <!--source:api-specifications-->Example Field<!--/source--> |
| `name` | `object` | <!--source:api-specifications-->Example Field<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `metric_type_name` | `string` | <!--source:api-specifications-->Unique identifier of the metric type<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Metric type created response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`POST` `/create-metric-type`

<!--source:api-specifications-->

#### Create Metric Type
<!--/source-->

`create_new_metric_type`

<!--source:api-specifications-->
This service defines a metric type and its fields, allowing the customer to create their own metrics based on events when a metric is posted to the Health.
<!--/source-->

<!--source:api-specifications-->
This service defines a metric type and its fields, allowing the customer to create their own metrics based on events when a metric is posted to the Health /post-metric service.

The metric type name is the main reference. The field names can be reference to build a new report.

<!--/source-->

##### Request

<!--source:api-specifications-->
01
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "metric_type_name": "test_000",
 "schema": {
 "type": "object",
 "required": [],
 "properties": {
 "name": {
 "type": "string"
 },
 "address": {
 "type": "string"
 },
 "product": {
 "type": "object",
 "properties": {
 "place": {
 "type": "string"
 },
 "sin": {
 "type": "string"
 }
 }
 },
 "techno": {
 "type": "array",
 "items": {
 "type": "number"
 }
 }
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "schema": {
 "type": "object",
 "required": [],
 "properties": {
 "name": {
 "type": "string"
 },
 "address": {
 "type": "string"
 },
 "product": {
 "type": "object",
 "properties": {
 "place": {
 "type": "string"
 },
 "sin": {
 "type": "string"
 }
 }
 },
 "techno": {
 "type": "array",
 "items": {
 "type": "number"
 }
 }
 }
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 0400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Metric type created response

```
{
 "message": "the new metric_type was successfully created"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "error": "error creating metric type: metric_type_name is a required field "
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->Key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `schema` | `object` | <!--source:api-specifications-->The metric type schema<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Type declaration example<!--/source--> |
| `required` | `string[]` | <!--source:api-specifications-->Required array. All the field which are required in the schema<!--/source--> |
| `properties` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `product` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `properties` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `address` | `object` | <!--source:api-specifications-->Example fields<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `techno` | `object` | <!--source:api-specifications-->Example Array Field<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `items` | `object` | <!--source:api-specifications-->Example Field<!--/source--> |
| `name` | `object` | <!--source:api-specifications-->Example Field<!--/source--> |
| `type` | `string` | <!--source:api-specifications-->Example type<!--/source--> |
| `metric_type_name` | `string` | <!--source:api-specifications-->Unique identifier of the metric type<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Metric type created response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Environments Data
<!--/source-->

`POST` `/register-env`

<!--source:api-specifications-->

#### Register Environment and API Key
<!--/source-->

`store_new_environment_credentials`

<!--source:api-specifications-->
Register the environment and api key the customer wants to get in reports.
<!--/source-->

<!--source:api-specifications-->
Register the environment and API key, this will allow Health to retrieve data from one environment to another. The data is migrated daily, the customer can retrieve reports from local and other registered environments.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy .

```
{
 "host": "test2.staircaseapi.com\"",
 "api-key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
400403
<!--/source-->

<!--source:api-specifications-->
text/html Copy 400 response.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `host`required | `string` | <!--source:api-specifications-->The environment host<!--/source-->Example `health.staircaseapi.com` |
| `api-key`required | `string (api-key)` | <!--source:api-specifications-->The api-key used in order to access APIs in the host<!--/source-->Example `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->The environment was stored successfully<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
400 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error in storing the environment invalid host<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
500 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Internal server error<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

<!--source:api-specifications-->

### Report Subscription
<!--/source-->

`POST` `/report-subscription`

<!--source:api-specifications-->

#### Create Report Subscription
<!--/source-->

`report-subscription`

<!--source:api-specifications-->
Subscription to receive a report through Slack notification.
<!--/source-->

<!--source:api-specifications-->
Subscription to receive a report through Slack notification. Specify the period either by days, week, or month, and the filters to apply.

You can subscribe to the following reports:

- Partner Report: Subscribe to receive the Partner report. See this link for more information.

- Products by operation status: Subscribe to receive the Product By Operation Status Report. See this link for more information.

- Summary Reports: Subscribe to receive the Summary Report by Status. See this link for more information.

- Products by unique transactions report: Subscribe to receive the Unique Transactions By Product Report. See this link for more information.

- Custom reports created in the service /build-report

The Slack media type is currently allowed. A token must be provided to send the notification. After the subscription, the user will receive the report through a post with the results in the configured period.

Follow this link to choose or create new apps in Slack. Use the app token "Bot User OAuth Token"

<!--/source-->

##### Request

<!--source:api-specifications-->
Example dailyExample cron dailyExample [x] daysExample weeklyExample monthlyCustom Report Example
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "subscription_name": "no5",
 "media": "slack",
 "send_to_id": "slack-channel-name",
 "period": "1d",
 "products": [
 "employment",
 "income",
 "Health"
 ],
 "environments": [
 "account.staircaseapi.com",
 "health.staircaseapi.com"
 ],
 "report_type": "summary_report",
 "token": "<redacted>"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "subscription_name": "no5",
 "media": "slack",
 "send_to_id": "slack-channel-name",
 "cron": "0 9,16 * * *",
 "products": [
 "employment",
 "income",
 "Health"
 ],
 "environments": [
 "account.staricaseapi.com",
 "health.staircaseapi.com"
 ],
 "report_type": "summary_report",
 "token": "<redacted>"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "subscription_name": "no3",
 "media": "slack",
 "send_to_id": "slack-channel-name",
 "period": "15d",
 "products": [
 "employment",
 "income",
 "Health"
 ],
 "environments": [
 "account.staircaseapi.com",
 "health.staircaseapi.com"
 ],
 "partners": [
 "atomic",
 "citadel"
 ],
 "report_type": "partner_report",
 "token": "<redacted>"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "subscription_name": "no2",
 "media": "slack",
 "send_to_id": "slack-channel-name",
 "period": "1w",
 "products": [
 "employment",
 "income",
 "Health"
 ],
 "environments": [
 "account.staircaseapi.com",
 "health.staircaseapi.com"
 ],
 "report_type": "product_unique_transactions_report",
 "token": "<redacted>"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "subscription_name": "no1",
 "media": "slack",
 "send_to_id": "slack-channel-name",
 "period": "1m",
 "products": [
 "employment",
 "income",
 "Health"
 ],
 "environments": [
 "account.staircaseapi.com",
 "health.staircaseapi.com"
 ],
 "report_type": "product_unique_transactions_report",
 "token": "<redacted>"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "media": "slack",
 "subscription_name": "no2",
 "send_to_id": "slack-channel-name",
 "period": "15d",
 "report_type": "custom_report_name",
 "token": "<redacted>"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 0400 1400 2400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Subscription success response

```
{
 "message": "Subscription successfully created"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Subscription error response

```
{
 "error": "period field is invalid. format allowed: <number>d, <number>w, <number>m "
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Subscription error response

```
{
 "error": "the Subscription solo already exists"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Subscription error response

```
{
 "error": "There is no custom report with the name: cabuc"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Subscription error response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
11 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `subscription_name`required | `string` | <!--source:api-specifications-->Unique Identifier of the Subscription<!--/source--> |
| `group_by` | `string` | <!--source:api-specifications-->Option to retrieve unique transactions by field transaction_id, request_collection_id or response_collection_id. It is only used in report type product_by_operation_status or partner report<!--/source--> |
| `period`required | `string` | <!--source:api-specifications-->The period is sent using d for days, w for weeks and m for months, the number always goes first e.g. 3w<!--/source--> |
| `cron`required | `string` | <!--source:api-specifications-->The scheduler definition is required for cumulative reports. Currently, supports only daily reports. Example of scheduler definition "0 9,16 * * *" → Get report between 00:00 - 09:00 and 00:00 - 16:00 for every day.<!--/source--> |
| `environments` | `string[]` | <!--source:api-specifications-->Environments<!--/source--> |
| `send_to_id`required | `string` | <!--source:api-specifications-->Slack channel name or Member ID (For private DM)<!--/source--> |
| `media`required | `string` | <!--source:api-specifications-->The only type allowed at the moment is slack<!--/source--> |
| `products` | `string[]` | <!--source:api-specifications-->List of products used in the query to build the reports which will be sent<!--/source--> |
| `partners` | `string[]` | <!--source:api-specifications-->List of partners (only for report_type = partner_report) used in the query to build the reports which will be sent<!--/source--> |
| `token` | `string` | <!--source:api-specifications-->In order to use it to send reports through slack this Field is required, the app token must be authorized in the User Token Scopes with files:write<!--/source--> |
| `report_type` | `string` | <!--source:api-specifications-->The report name (partner_report, summary_report, product_by_operation_status and product_unique_transactions_report) or Custom report name<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Subscription success response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Subscription error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`POST` `/error-subscription`

<!--source:api-specifications-->

#### Create Error Report Subscription
<!--/source-->

`create_error_subscription`

<!--source:api-specifications-->
This service sends a notification when an error is posted for a product service endpoint in Health.
<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "media": "slack",
 "subscription_name": "my-error-subscription",
 "send_to_id": "U04SR512392R",
 "products": [
 "Account",
 "employment"
 ],
 "token": "<redacted>"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 0400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success Response

```
{
 "message": "Subscription successfully created"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error Response

```
{
 "error": "products is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error Response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->Key<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `subscription_name` | `string` | <!--source:api-specifications-->Unique Identifier of the Subscription<!--/source--> |
| `send_to_id` | `string` | <!--source:api-specifications-->Slack channel name or Member ID (For private DM)<!--/source--> |
| `media` | `string` | <!--source:api-specifications-->The only type allowed at the moment is slack<!--/source--> |
| `products` | `string[]` | <!--source:api-specifications-->List of products used in the query to build the reports which will be sent<!--/source--> |
| `token` | `string` | <!--source:api-specifications-->In order to use it to send reports through slack this Field is required, the app token must be authorized in the User Token Scopes with files:write<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`DELETE` `/delete-subscription/{subscription_id}`

<!--source:api-specifications-->

#### Delete Report Subscription
<!--/source-->

`delete_subscription_id`

<!--source:api-specifications-->
This service allows removing a notification subscription.
<!--/source-->

<!--source:api-specifications-->
This service allows removing a notification subscription, the subscription name must be provided. After deleting the subscription, the notification will not be received through slack.

<!--/source-->

##### Response

<!--source:api-specifications-->
200 0200 2400403404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Auto generated using Swagger Inspector

```
{
 "message": "subscription no2 successfully deleted"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Auto generated using Swagger Inspector

```
{
 "message": "subsription te99 not found"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Bad request.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |
| `subscription_id` required | `string` path | `MNe` | <!--source:api-specifications-->Unique identifier of a subscription which will be deleted.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Auto generated using Swagger Inspector
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Bad request.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`DELETE` `/delete-error-subscription/{subscription_id}`

<!--source:api-specifications-->

#### Delete Report Error Subscription
<!--/source-->

`delete-error-subscription`

<!--source:api-specifications-->
This service allows removing a notification subscription.
<!--/source-->

<!--source:api-specifications-->
This service allows removing a notification subscription, the subscription name must be provided. After deleting the subscription, the notification will not be received through Slack.

<!--/source-->

##### Response

<!--source:api-specifications-->
200 0200 2400403404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Auto generated using Swagger Inspector

```
{
 "message": "subscription no2 successfully deleted"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Auto generated using Swagger Inspector

```
{
 "message": "subsription te99 not found"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Bad request.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Not found.

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>404 Not found</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |
| `subscription_id` required | `string` path | `MNe` | <!--source:api-specifications-->Unique identifier of a subscription which will be deleted.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Auto generated using Swagger Inspector
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Bad request.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message.<!--/source--> |

`GET` `/get-subscriptions`

<!--source:api-specifications-->

#### Retrieve All Report Subscriptions
<!--/source-->

`get_all_subscription`

<!--source:api-specifications-->
It retrieves a list of subscriptions registered, all subscriptions send a notification with the report type selected, the method, and the send_to_id.
<!--/source-->

##### Response

<!--source:api-specifications-->
200400403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Subscription data.

```
{
 "subscriptions": [
 {
 "subscription_name": "ass",
 "media": "slack",
 "send_to_id": "test",
 "period": "15d",
 "cron": null,
 "report_type": "summary_report",
 "query_info": {
 "customer_x_api_key": "iaia-222-4ca4-a061-xxxaoaoao",
 "environments": [
 "account.staircaseapi.com",
 "health.staircaseapi.com"
 ],
 "products": [
 "employment",
 "income",
 "Health"
 ]
 }
 }
 ],
 "error_subscriptions": [
 {
 "subscription_name": "11",
 "media": "slack",
 "query_info": {
 "products": [
 "Health"
 ]
 }
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy 400 Bad Request

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Subscription data.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `subscriptions` | `object[]` | <!--source:api-specifications-->Subscription data.<!--/source--> |
| `period` | `string` | <!--source:api-specifications-->Period.<!--/source--> |
| `cron` | `string` | <!--source:api-specifications-->Period.<!--/source--> |
| `send_to_id` | `string` | <!--source:api-specifications-->ID where it will be sent.<!--/source--> |
| `subscription_name` | `string` | <!--source:api-specifications-->Unique identifier of the subscription.<!--/source--> |
| `media` | `string` | <!--source:api-specifications-->Slack the only value allowed at the moment.<!--/source--> |
| `report_type` | `string` | <!--source:api-specifications-->Type of the report.<!--/source--> |
| `query_info` | `object` | <!--source:api-specifications-->Filters detail<!--/source--> |
| `customer_x_api_key` | `string` | <!--source:api-specifications-->It is the key required in order to use the API. Filters by customer_api_key.<!--/source--> |
| `environments` | `string[]` | <!--source:api-specifications-->Environments<!--/source--> |
| `products` | `string[]` | <!--source:api-specifications-->List of products used in the query to build the reports which will be sent<!--/source--> |
| `error_subscriptions` | `object[]` | <!--source:api-specifications-->Error Subscriptions<!--/source--> |
| `subscription_name` | `string` | <!--source:api-specifications-->Unique identifier of the subscription.<!--/source--> |
| `send_to_id` | `string` | <!--source:api-specifications-->ID where it will be sent.<!--/source--> |
| `query_info` | `object` | <!--source:api-specifications-->Filters detail<!--/source--> |
| `products` | `string[]` | <!--source:api-specifications-->List of products for error metrics.<!--/source--> |
| `media` | `string` | <!--source:api-specifications-->Slack the only value allowed at the moment.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
400 Bad Request
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `error` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Reports
<!--/source-->

`GET` `/summary_report_by_status`

<!--source:api-specifications-->

#### Retrieve Summary Report by Status
<!--/source-->

`get_report_summary_report_by_status`

<!--source:api-specifications-->
This report brings the total number of metrics by status.
<!--/source-->

<!--source:api-specifications-->
This report brings the total number of metrics by status. You can get the following information about your products by using this report:

- The metrics posted for per product

- The metrics that succeeded per product.

- The metrics that failed, this means that an error or exception occurred in the product while processing one of the services.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 Error Response Example400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Example Success Response

```
{
 "report": {
 "Items": [
 {
 "product_name": "service-decision-api-dev",
 "host_env": "account.staircaseapi.com",
 "succeeded": "2",
 "total": 2
 },
 {
 "product_name": "income-dev",
 "host_env": "account.staircaseapi.com",
 "succeeded": "2",
 "total": 2
 },
 {
 "product_name": "assessments",
 "host_env": "health.staircaseapi.com",
 "succeeded": "9",
 "total": 9
 },
 {
 "product_name": "employment",
 "host_env": "health.staircaseapi.com",
 "succeeded": "21",
 "failed": "5",
 "total": 26
 }
 ],
 "Next_token": " "
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: end_date is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `start_date` required | `string` query | `2021-04-01` | <!--source:api-specifications-->Filters by start_date it must be used together with the end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `end_date` required | `string` query | `2021-05-30` | <!--source:api-specifications-->Filters by end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `environments` | `string` query | `account.staircaseapi.com,health.staircaseapi.com` | <!--source:api-specifications-->List of host environment to filter, the report will bring all environments if this input is not available. Only configured environments will be included in the reports.<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter, the report will bring all product names if this input is not available.<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Example Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->report<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Items<!--/source--> |
| `total` | `integer` | <!--source:api-specifications-->Total<!--/source--> |
| `host_env` | `string` | <!--source:api-specifications-->Environment<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product name<!--/source--> |
| `succeeded` | `string` | <!--source:api-specifications-->Succeeded<!--/source--> |
| `failed` | `string` | <!--source:api-specifications-->Failed<!--/source--> |
| `Next_token` | `string` | <!--source:api-specifications-->Next token pagination purpose<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
500 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Internal server error<!--/source--> |

`GET` `/partner_report`

<!--source:api-specifications-->

#### Retrieve Partner Report
<!--/source-->

`get_report_partner_report`

<!--source:api-specifications-->
This report retrieves the number of transactions and the last operation status by partner in the given timeframe period.
<!--/source-->

<!--source:api-specifications-->
The Mortgage products operations with a data partner are registered from the beginning of the transaction until it is completed. This report retrieves the number of transactions and the last operation status by partner in the given timeframe period.

The data will be aggregated between all environments registered. See this link for more information.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Success Response

```
{
 "report": {
 "Items": [
 {
 "product_name": "employment",
 "partner": "atomic",
 "total_by_status": {
 "STARTED": 1,
 "IN_PROGRESS": 3,
 "COMPLETED": 1
 },
 "total": 5
 },
 {
 "product_name": "income",
 "partner": "truework",
 "total_by_status": {
 "STARTED": 1,
 "COMPLETED": 2,
 "CANCELLED": 1
 },
 "total": 4
 },
 {
 "product_name": "employment",
 "partner": "truework",
 "total_by_status": {
 "STARTED": 2,
 "COMPLETED": 3,
 "CANCELLED": 6
 },
 "total": 11
 },
 {
 "product_name": "employment",
 "partner": "citadel",
 "total_by_status": {
 "STARTED": 1,
 "IN_PROGRESS": 4
 },
 "total": 5
 },
 {
 "product_name": "employment",
 "partner": "argyle",
 "total_by_status": {
 "IN_PROGRESS": 5
 },
 "total": 5
 },
 {
 "product_name": "employment",
 "partner": "verix",
 "total_by_status": {
 "COMPLETED": 6
 },
 "total": 6
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Auto generated using Swagger Inspector

```
{
 "message": "error: end_date is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
7
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `start_date` required | `string` query | `2021-05-01` | <!--source:api-specifications-->Filters the data by a range of dates starting with this date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `end_date` required | `string` query | `2021-05-31` | <!--source:api-specifications-->Filters the data until this date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `environments` | `string` query | `documentation.staircaseapi.com` | <!--source:api-specifications-->List of host environment to filter, the report will bring all environments if this input is not available. Only configured environments will be included in the reports.<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter, the report will bring all product names if this input is not available.<!--/source--> |
| `group_by` | `string` query | `request_collection_id` | <!--source:api-specifications-->Option to retrieve unique transactions by field transaction_id, request_collection_id or response_collection_id.<!--/source--> |
| `partners` | `string` query | `atomic,citadel` | <!--source:api-specifications-->The name of the data partners in Mortgage products.<!--/source--> |
| `x-api-key` | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->Report<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Items<!--/source--> |
| `total` | `integer` | <!--source:api-specifications-->Total<!--/source--> |
| `partner` | `string` | <!--source:api-specifications-->Partner<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product name<!--/source--> |
| `total_by_status` | `object` | <!--source:api-specifications-->Total<!--/source--> |
| `COMPLETED` | `integer` | <!--source:api-specifications-->Operation status<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Auto generated using Swagger Inspector
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `504``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
504 Timeout response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Endpoint request timed out<!--/source--> |

`GET` `/product_by_operation_status`

<!--source:api-specifications-->

#### Retrieve Product by Operation Status Report
<!--/source-->

`get_report_product_by_operation_status`

<!--source:api-specifications-->
This report retrieves the number of transactions and the last operation's status for the given timeframe period.
<!--/source-->

<!--source:api-specifications-->
Every single Staircase service endpoint (such as POST /persistence/transactions or POST /aus/underwrite) is required to provide operation status updates to denote the progress of a transaction in its execution. For more information and examples see this link

This report retrieves the number of transactions and the last operation's status for the given timeframe period.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 Error Response Example400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Example Success Response

```
{
 "report": {
 "Items": [
 {
 "product_name": "get-code-clone",
 "host_env": "health.staircaseapi.com",
 "total_by_status": {
 "STARTED": 11,
 "IN PROGRESS": 21
 },
 "total": 32
 }
 ]
 },
 "next_token": "eyJOZXh0VG9rZW4iOiAiQVJ0Zkl4L2QvOVdnRUpBTFJidWNQU0c0MVhrS3lTVURJU3JobCt3dHEvaUZxM3NNa0R2S3NSS0pVdmh4RVZQME5CRzBtS2lGTnF0ZGZlMTBpS3RsM09EZTBSZ0I0OS8rbXc9PSIsICJRdWVyeUV4ZWN1dGlvbklkIjogIjFhYzgwMDUyLTgwNzktNDA4YS04OWU3LTlmM2Q4NWEzZWVjMSJ9"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: end_date is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
7
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `start_date` required | `string` query | `2021-04-01` | <!--source:api-specifications-->Filters by start_date it must be used together with the end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `end_date` required | `string` query | `2021-05-30` | <!--source:api-specifications-->Filters by end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `environments` | `string` query | `account.staircaseapi.com,health.staircaseapi.com` | <!--source:api-specifications-->List of host environment to filter, the report will bring all environments if this input is not available. Only configured environments will be included in the reports.<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter, the report will bring all product names if this input is not available.<!--/source--> |
| `group_by` | `string` query | `request_collection_id` | <!--source:api-specifications-->Option to retrieve unique transactions by field transaction_id, request_collection_id or response_collection_id.<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Example Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->Report<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Items<!--/source--> |
| `total` | `integer` | <!--source:api-specifications-->Total<!--/source--> |
| `host_env` | `string` | <!--source:api-specifications-->Environment<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product Name<!--/source--> |
| `IN PROGRESS` | `string` | <!--source:api-specifications-->Operation Status<!--/source--> |
| `STARTED` | `string` | <!--source:api-specifications-->Operation Status<!--/source--> |
| `Next_token` | `string` | <!--source:api-specifications-->Next token pagination<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
500 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Internal server error<!--/source--> |

`GET` `/product_unique_transactions_report`

<!--source:api-specifications-->

#### Retrieve Unique Transactions By Product Report
<!--/source-->

`get_report_product_unique_transactions_report`

<!--source:api-specifications-->
This report brings the total number of unique transactions by status and a breakdown per day.
<!--/source-->

<!--source:api-specifications-->
This report brings the total number of unique transactions by status and a breakdown per day. We can have multiple metrics registered for the same transaction, this report will bring unique transaction id count.

You can get the following information about your products by using this report:

- The transactions processed per product.

- The transactions that were processed by a service endpoint and succeeded.

- The transactions that were processed by a service endpoint and reported an exception or error.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 Error Response Example400 text/html403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Example Success Response

```
{
 "report": {
 "Items": [
 {
 "product_name": "Health",
 "host_env": "account.staircaseapi.com",
 "total_unique_transactions": 71,
 "failed": 0,
 "succeeded": 71,
 "per_day": [
 {
 "day": "2021-05-24",
 "succeeded": 7,
 "unique_transactions": 7
 },
 {
 "day": "2021-05-25",
 "succeeded": 31,
 "unique_transactions": 31
 },
 {
 "day": "2021-05-26",
 "succeeded": 12,
 "unique_transactions": 12
 },
 {
 "day": "2021-05-27",
 "succeeded": 8,
 "unique_transactions": 8
 },
 {
 "day": "2021-05-28",
 "unique_transactions": 0
 },
 {
 "day": "2021-05-29",
 "unique_transactions": 0
 },
 {
 "day": "2021-05-30",
 "unique_transactions": 0
 },
 {
 "day": "2021-05-31",
 "unique_transactions": 0
 },
 {
 "day": "2021-06-01",
 "succeeded": 6,
 "unique_transactions": 6
 },
 {
 "day": "2021-06-02",
 "succeeded": 7,
 "unique_transactions": 7
 }
 ]
 }
 ]
 },
 "next_token": "DUyLTgwNzktNDA4YS04OWU3LTlmM2Q4NWEzZWVjMSJ9"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: end_date is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
text/html Copy Error response

```
<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `start_date` required | `string` query | `2021-04-01` | <!--source:api-specifications-->Filters by start_date it must be used together with the end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `end_date` required | `string` query | `2021-05-30` | <!--source:api-specifications-->Filters by end_date. Date must be in ISO8601 format: YYYY-MM-DD<!--/source--> |
| `environments` | `string` query | `account.staircaseapi.com,health.staircaseapi.com` | <!--source:api-specifications-->List of host environment to filter, the report will bring all environments if this input is not available. Only configured environments will be included in the reports.<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter, the report will bring all product names if this input is not available.<!--/source--> |
| `next_token` | `string` query | `000000000000` | <!--source:api-specifications-->The token for the next set of items to return. (You received this token from a previous call. If you have reached the end of the stream, the returned token is null.)<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Example Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->Report<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Item<!--/source--> |
| `total_unique_transactions` | `integer` | <!--source:api-specifications-->Total<!--/source--> |
| `host_env` | `string` | <!--source:api-specifications-->Environment<!--/source--> |
| `per_day` | `object[]` | <!--source:api-specifications-->Total per day<!--/source--> |
| `day` | `string` | <!--source:api-specifications-->Date<!--/source--> |
| `unique_transactions` | `integer` | <!--source:api-specifications-->Total per day<!--/source--> |
| `succeeded` | `integer` | <!--source:api-specifications-->Total Succeeded per day<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product name<!--/source--> |
| `Next_token` | `string` | <!--source:api-specifications-->Next token pagination<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
500 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Internal server error<!--/source--> |

`GET` `/cost-report-day`

<!--source:api-specifications-->

#### Retrieve Cost Report Grouped by day
<!--/source-->

`get_cost_report_by_day`

<!--source:api-specifications-->
Retrieve Cost Report Grouped by day.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 0400 2400 3403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Example Success Response

```
{
 "report": {
 "data": {
 "cost_category": "customer",
 "total_cost": 10958155,
 "total_transaction_count": 115349,
 "dates": [
 {
 "date": "2021-12-04",
 "total_cost": 151240,
 "total_transaction_count": 1592,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 151240,
 "total_transaction_count": 1592,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 151240,
 "total_transaction_count": 1592
 }
 ]
 }
 ]
 },
 {
 "date": "2021-12-05",
 "total_cost": 303810,
 "total_transaction_count": 3198,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 303810,
 "total_transaction_count": 3198,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 303810,
 "total_transaction_count": 3198
 }
 ]
 }
 ]
 },
 {
 "date": "2021-12-06",
 "total_cost": 534375,
 "total_transaction_count": 5625,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 534375,
 "total_transaction_count": 5625,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 534375,
 "total_transaction_count": 5625
 }
 ]
 }
 ]
 }
 ]
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: cost_category is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: product_name is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: start_date is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `end_date` required | `string` query | `2021-10-18` | <!--source:api-specifications-->end_date<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter<!--/source--> |
| `cost_category` required | `string` query | `customer` | <!--source:api-specifications-->Cost Category (customer, partner)<!--/source--> |
| `start_date` required | `string` query | `2021-10-12` | <!--source:api-specifications-->start_date<!--/source--> |
| `environments` | `string` query | `account.staircaseapi.com,health.staircaseapi.com` | <!--source:api-specifications-->List of host environment to filter, the report will bring all environments if this input is not available. Only configured environments will be included in the reports.<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Example Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->Response object<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Array of Items<!--/source--> |
| `cost_in_cents` | `string` | <!--source:api-specifications-->Cost in USD cents.<!--/source--> |
| `day` | `string` | <!--source:api-specifications-->The date.<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product_name<!--/source--> |
| `cost_category` | `string` | <!--source:api-specifications-->Cost Category<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
500 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Internal server error<!--/source--> |

`GET` `/cost-report-month`

<!--source:api-specifications-->

#### Retrieve Cost Report of a given month
<!--/source-->

`get_cost_report_month`

<!--source:api-specifications-->
Retrieve Cost Report of a given month.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 0400 1403
<!--/source-->

<!--source:api-specifications-->
application/json Copy Example Success Response

```
{
 "report": {
 "data": {
 "cost_category": "customer",
 "total_cost": 11133050,
 "total_transaction_count": 117190,
 "dates": [
 {
 "date": "2021-12",
 "total_cost": 11133050,
 "total_transaction_count": 117190,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 11133050,
 "total_transaction_count": 117190,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 11133050,
 "total_transaction_count": 117190
 }
 ]
 }
 ]
 }
 ]
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: month is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: cost_category is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 403 response

```
{
 "url": "https://staircase.stoplight.io/docs/api-reference/customer-account-manager-service.yml/paths/~1products~1refresh/post",
 "message": "This key is not valid for this service."
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
4
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `month` required | `string` query | `10` | <!--source:api-specifications-->Month<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter<!--/source--> |
| `cost_category` required | `string` query | `customer` | <!--source:api-specifications-->Cost Category (customer, partner)<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Example Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->Response object<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Array of Items<!--/source--> |
| `cost_in_cents` | `string` | <!--source:api-specifications-->Cost in USD cents.<!--/source--> |
| `day` | `string` | <!--source:api-specifications-->The date.<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product_name<!--/source--> |
| `cost_category` | `string` | <!--source:api-specifications-->Cost Category<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
403 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string` | <!--source:api-specifications-->URL<!--/source--> |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `500``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
500 response.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Internal server error<!--/source--> |

`GET` `/cost-report`

<!--source:api-specifications-->

#### Retrieve Cost Report of a given interval
<!--/source-->

`get_cost_report`

<!--source:api-specifications-->
Retrieve Cost Report of a given interval.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 0400 1400 3
<!--/source-->

<!--source:api-specifications-->
application/json Copy Example Success Response

```
{
 "report": {
 "data": {
 "cost_category": "customer",
 "total_cost": 2081260,
 "total_transaction_count": 21908,
 "dates": [
 {
 "date": "2021-12-24",
 "total_cost": 913235,
 "total_transaction_count": 9613,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 913235,
 "total_transaction_count": 9613,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 913235,
 "total_transaction_count": 9613
 }
 ]
 }
 ]
 },
 {
 "date": "2021-12-25",
 "total_cost": 783940,
 "total_transaction_count": 8252,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 783940,
 "total_transaction_count": 8252,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 783940,
 "total_transaction_count": 8252
 }
 ]
 }
 ]
 },
 {
 "date": "2021-12-26",
 "total_cost": 384085,
 "total_transaction_count": 4043,
 "environments": [
 {
 "environment_name": "health.staircaseapi.com",
 "total_cost": 384085,
 "total_transaction_count": 4043,
 "products": [
 {
 "product_name": "Health",
 "cost_in_cents": 95,
 "total_cost": 384085,
 "total_transaction_count": 4043
 }
 ]
 }
 ]
 }
 ]
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: end_date is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: cost_category is a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Error response

```
{
 "message": "error: product_name is a required field"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
7
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `end_date` required | `string` query | `2021-10-18` | <!--source:api-specifications-->end_date<!--/source--> |
| `products` | `string` query | `employment,income` | <!--source:api-specifications-->List of product names to filter<!--/source--> |
| `cost_category` required | `string` query | `customer` | <!--source:api-specifications-->Cost Category (customer, partner)<!--/source--> |
| `start_date` required | `string` query | `2021-10-12` | <!--source:api-specifications-->start_date<!--/source--> |
| `date_range_type` | `string` query | `daily` | <!--source:api-specifications-->Allows grouping costs by selected date type.<!--/source--> |
| `environments` | `string` query | `account.staircaseapi.com,health.staircaseapi.com` | <!--source:api-specifications-->List of host environment to filter, the report will bring all environments if this input is not available. Only configured environments will be included in the reports.<!--/source--> |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->API key<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Example Success Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report` | `object` | <!--source:api-specifications-->Response object<!--/source--> |
| `Items` | `object[]` | <!--source:api-specifications-->Array of Items<!--/source--> |
| `cost_in_cents` | `string` | <!--source:api-specifications-->Cost in USD cents.<!--/source--> |
| `day` | `string` | <!--source:api-specifications-->The date.<!--/source--> |
| `product_name` | `string` | <!--source:api-specifications-->Product_name<!--/source--> |
| `cost_category` | `string` | <!--source:api-specifications-->Cost Category<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Error response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

## Canonical model

- `address`
- `address`

## Property data it reads

- address

## Errors

`400``403``404``422``500``502``504`

## More in Shipping

- Previous product: Deploy
- Next product: Pipeline
