<!-- https://staircase.co/delivery/distribution/finance -->
# Finance

# Finance

Metering and billing keyed to the same product identifier every endpoint definition carries.

Finance meters each invocation against the product API it called, using the identifier already present in that endpoint's definition. There is no separate billing catalogue to keep in step with the API catalogue, because they are the same identifier.

Price revisions are versioned per API, and vendor cost is reported alongside what was charged.

## How it works

Metered units can be negative. That is what expresses a charge reversed when a call returned nothing usable — a credit rather than a suppressed record, so the ledger still shows the attempt.

Keeping the attempt visible matters for the waterfall: a vendor tried and returning nothing is exactly the event the ordering is tuned on.

## Operations

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

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

`POST` `/metrics`

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

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

`createFinanceMetric`

<!--source:api-specifications-->
Create Finance Metric
<!--/source-->

<!--source:api-specifications-->
This service enables storing finance metrics. The unit value is a required field that can be either positive or negative according to the direction of the transaction.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "product_api_identifier": "product_api_identifier_2",
 "product_price_identifier": "product_price_identifier_2",
 "product_identifier": "c5b45e21-6946-4110-bf83-8ca90fac5493",
 "transaction_id": "01G0KZARZ46W8KZ81277V5C0HA",
 "request_collection_id": "2I8JNKZARZ46W8KZ81277V5CASD",
 "response_collection_id": "328JNKZARZ46W8KZ81277V5SKDS",
 "company_name": "customer_comp",
 "price_unit_type": "transaction",
 "price_timing_type": "completion",
 "price_amount": 10,
 "price_amount_unit_type": "cents"
}
```

<!--/source-->

##### Response

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

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

```
{
 "message": "metric 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-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

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

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

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

| Field | Type | Description |
| --- | --- | --- |
| `product_api_identifier`required | `string` | <!--source:api-specifications-->Unique identifier for payable unit<!--/source-->Example `product_api_identifier_1` |
| `product_price_identifier`required | `string` | <!--source:api-specifications-->Unique identifier for price<!--/source-->Example `product_price_identifier_1` |
| `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 `01G0KZARZ46W8KZ81277V5C0HA` |
| `request_collection_id` | `string` | <!--source:api-specifications-->Unique identifier for Staircase request collection<!--/source-->Example `2I8JNKZARZ46W8KZ81277V5CASD` |
| `response_collection_id` | `string` | <!--source:api-specifications-->Unique identifier for Staircase response collection<!--/source-->Example `328JNKZARZ46W8KZ81277V5SKDS` |
| `company_name` | `string` | <!--source:api-specifications-->Company name<!--/source-->Example `comp_name` |
| `price_unit_type`required | `string` | <!--source:api-specifications-->The unit of the platform where the price evaluation can be determined as relevant<!--/source-->`api_call``datapoint``document``environment``hour``image``page``person``person-hour``pm``pm-hour``product``seat``subscription``transaction`Example `product` |
| `price_timing_type`required | `string` | <!--source:api-specifications-->Price is included into billing based on this defined schedule.<!--/source-->`completion``monthly`Example `completion` |
| `product_identifier`required | `string` | <!--source:api-specifications-->Unique identifier for product<!--/source-->Example `c5b45e21-6946-4110-bf83-8ca90fac5493` |
| `price_amount`required | `number` | <!--source:api-specifications-->Value of the unit in selected unit price. This value can be negative or positive.<!--/source-->Example `95` |
| `price_amount_unit_type`required | `string` | <!--source:api-specifications-->Unit of the price<!--/source-->`cents`Example `cents` |

##### 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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

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

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

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

`POST` `/products/finance-service/custom_endpoint/create-finance-metric`

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

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

`createFinanceMetric`

<!--source:api-specifications-->
Create finance metric
<!--/source-->

<!--source:api-specifications-->
Create finance metric. Results will be saved in the output collection. Remember transaction_id and response_collection_id from the response to get the collection data from Persistence API: Retrieve Collection

Response collection example

```
{
 "metadata": {
 "version": 2,
 "validation": true,
 "product_name": "finance-service"
 },
 "transaction_id": "01GME0M8HH3TXS0STWANH32VRC",
 "collection_id": "01GME0M8KYYBNYQSEVB7MXKVXW",
 "data": {
 "finance_metrics": [
 {
 "@id": "01GQJPZJAFSMTB9EDYKGQ85VKK",
 "@type": "finance_metric",
 "has_finance_metrShow the restic_identifier": {
 "has_value": "01GQJPZJAFSMTB9EDYKGQ85VKK"
 },
 "has_collection_id": {
 "has_value": ""
 },
 "has_organization_id": {
 "has_value": "john.doe@test.co"
 },
 "has_produce_identifier": {
 "has_value": "customer"
 },
 "has_product_api_identifier": {
 "has_value": "active"
 },
 "has_transaction_id": {
 "has_value": "test-co-1"
 }
 }
 ]
 }
 }
}
```

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "request_data": {
 "finance_metrics": [
 {
 "has_transaction_id": {
 "has_value": "test-co-1"
 },
 "has_collection_id": {
 "has_value": "https://test-co-1.com"
 },
 "has_organization_id": {
 "has_value": "john.doe@test.co"
 },
 "has_produce_identifier": {
 "has_value": "customer"
 },
 "has_product_api_identifier": {
 "has_value": "product-api-identifier"
 }
 }
 ]
 }
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Successfully started flow invocation.

```
{
 "invocation_id": "9aefb465-90fb-4d50-8ae6-2df2b58373f4",
 "invocation_status": "STARTED",
 "product_flow_name": "product_flow_name_example",
 "transaction_id": "01F6NAMXWN2XVBD1YJ92A6S6R4",
 "request_collection_id": "01F6NAQ4894HPMCBGB4P0G95XK",
 "response_collection_id": "01F6NAQ4894HPMCBGB4P0G78HG",
 "options": {
 "dry_run": false
 },
 "tags": [
 "manual verification"
 ],
 "widget_url": "https://product-dev-productsbucket-1j472c4onqkxw.s3.amazonaws.com/widgets/063f5f"
}
```

<!--/source-->

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

```
{
 "message": {
 "schema_type": [
 "Must be one of: create, update."
 ]
 }
}
```

<!--/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-->Environment API Key.<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->Callback URL.<!--/source--> |
| `request_data`required | `object` | <!--source:api-specifications-->Request JSON body.<!--/source--> |
| `finance_metrics` | `object[]` | <!--source:api-specifications-->Finance metric filter<!--/source--> |
| `has_transaction_id` | `object` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `has_value` | `string` | <!--source:api-specifications-->Transaction ID<!--/source-->Example `01GQJPZG07MMFTF6ZZ3BVK1ZFP` |
| `has_collection_id` | `object` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `has_value` | `string` | <!--source:api-specifications-->Collection ID<!--/source-->Example `01GQJPZFXPRR8QMR31CG92J27D` |
| `has_organization_id` | `object` | <!--source:api-specifications-->Organization ID<!--/source--> |
| `has_value` | `string` | <!--source:api-specifications-->Organization ID<!--/source-->Example `test-co-1@gmail.com` |
| `has_produce_identifier` | `object` | <!--source:api-specifications-->Product Identifier<!--/source--> |
| `has_value` | `string` | <!--source:api-specifications-->Product Identifier<!--/source-->Example `customer` |
| `has_product_api_identifier` | `object` | <!--source:api-specifications-->Product API Identifier<!--/source--> |
| `has_value` | `string` | <!--source:api-specifications-->Product API Identifier<!--/source-->Example `62f5691e-7fd0-4728-ac3c-977dea07f338` |

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

<!--source:api-specifications-->
12 fields
<!--/source-->
<!--source:api-specifications-->
Successfully started flow invocation.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `invocation_id`required | `string` | <!--source:api-specifications-->Invocation ID.<!--/source--> |
| `invocation_status`required | `string` | <!--source:api-specifications-->The status of the invocation.<!--/source-->`STARTED` |
| `transaction_id`required | `string` | <!--source:api-specifications-->Transaction ID.<!--/source--> |
| `request_collection_id`required | `string` | <!--source:api-specifications-->Request collection ID.<!--/source--> |
| `response_collection_id`required | `string` | <!--source:api-specifications-->Response collection ID.<!--/source--> |
| `product_flow_name` | `string` | <!--source:api-specifications-->Product flow name.<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->The metadata of the invoked product flow.<!--/source--> |
| `callback_url` | `string` | <!--source:api-specifications-->Callback URL.<!--/source--> |
| `request_data` | `object` | <!--source:api-specifications-->The data for the request collection.<!--/source--> |
| `tags` | `string[]` | <!--source:api-specifications-->List of tags.<!--/source--> |
| `options` | `object` | <!--source:api-specifications-->Additional information that should be passed to the connector but not be added to the request collection.<!--/source--> |
| `widget_url` | `string` | <!--source:api-specifications-->Product widget_url listening on the connector widget_url<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Either message or object with additional properties.<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Request forbidden -- authorization will not help<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->Indicates at which url the error occurs<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Partner, flow or execution not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Nothing matches the given URI<!--/source--> |

`POST` `/metrics/query`

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

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

`create_async_query_execution`

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

<!--source:api-specifications-->
The service creates asynchronous query execution to 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.

<!--/source-->

##### Request

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

```
{
 "product_api_identifier": "c4c7a50e-ef10-4885-9a9d-2c04d7410084",
 "product_price_identifier": "ecb11b04-e99c-4610-8db1-990367c25883",
 "transaction_id": "01F2Q6WJXF5DK3ERTZ18JHSNE8",
 "start_date": "2022-04-11",
 "end_date": "2022-04-15"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html403
<!--/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-->

<!--source:api-specifications-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

##### Parameters

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

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

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

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

| Field | Type | Description |
| --- | --- | --- |
| `product_api_identifier` | `string` | <!--source:api-specifications-->Unique identifier for payable unit<!--/source-->Example `product_api_identifier_1` |
| `product_price_identifier` | `string` | <!--source:api-specifications-->Unique identifier for price<!--/source-->Example `product_price_identifier_1` |
| `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 `01G0KZARZ46W8KZ81277V5C0HA` |
| `request_collection_id` | `string` | <!--source:api-specifications-->Unique identifier for Staircase request collection<!--/source-->Example `2I8JNKZARZ46W8KZ81277V5CASD` |
| `response_collection_id` | `string` | <!--source:api-specifications-->Unique identifier for Staircase response collection<!--/source-->Example `328JNKZARZ46W8KZ81277V5SKDS` |
| `company_name` | `string` | <!--source:api-specifications-->Company name<!--/source-->Example `comp_name` |
| `price_unit_type` | `string` | <!--source:api-specifications-->The unit of the platform where the price evaluation can be determined as relevant<!--/source-->`api_call``datapoint``document``environment``hour``image``page``person``person-hour``pm``pm-hour``product``seat``subscription``transaction`Example `product` |
| `price_timing_type` | `string` | <!--source:api-specifications-->Price is included into billing based on this defined schedule.<!--/source-->`completion``monthly`Example `completion` |
| `product_identifier` | `string` | <!--source:api-specifications-->Unique identifier for the product<!--/source-->Example `3f312801-e3bb-49c2-a59b-8e2c05958c1b` |
| `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-04-13` |
| `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-04-16` |

##### 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-->
Bad request syntax or forbidden request
<!--/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-->
Forbidden
<!--/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 Query Result
<!--/source-->

`get_async_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/html403404
<!--/source-->

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

```
{
 "query_id": "fd99d4de-1632-487f-8576-2ee064e75b51",
 "status": "SUCCEEDED",
 "result_csv_file": "https://finance-athena-result-795294970345.s3.amazonaws.com/fd99d4de-1632-487f-8576-2ee064e75b51.csv&Expires=1659342953",
 "data": {
 "metrics": [
 {
 "product_api_identifier": "c4c7a50e-ef10-4885-9a9d-2c04d7410084",
 "product_price_identifier": "ecb11b04-e99c-4610-8db1-990367c25883",
 "transaction_id": "da2dbe64-33c0-4de2-b5a4-745f0b60ee4c",
 "host_environment": "documentation.staircaseapi.com",
 "date": "2022-08-01 03:32:42.000",
 "company_name": "bohr",
 "price_unit_type": "subscription",
 "price_timing_type": "monthly",
 "price_amount": "10000.0",
 "price_amount_unit_type": "cents"
 },
 {
 "product_api_identifier": "df7d610c-0e6e-4bbd-86c0-7de39e29dd8a",
 "product_price_identifier": "6c58cf4d-0d97-49dd-8d1a-fd44387734e4",
 "transaction_id": "aaa55ebb-43e8-4722-96cd-050bf2b5c29c",
 "host_environment": "documentation.staircaseapi.com",
 "date": "2022-08-01 03:32:20.000",
 "company_name": "bohr",
 "price_unit_type": "subscription",
 "price_timing_type": "monthly",
 "price_amount": "50000.0",
 "price_amount_unit_type": "cents"
 },
 {
 "product_api_identifier": "6ee48f0c-7bd8-43de-9bf9-afce5e85bd08",
 "product_price_identifier": "4159a209-bc65-48eb-8735-7cb3600d7fa0",
 "transaction_id": "2c71d744-9589-4812-a373-e4bcec7df5c5",
 "host_environment": "documentation.staircaseapi.com",
 "date": "2022-08-01 03:28:51.000",
 "company_name": "bohr",
 "price_unit_type": "subscription",
 "price_timing_type": "monthly",
 "price_amount": "100000.0",
 "price_amount_unit_type": "cents"
 }
 ]
 }
}
```

<!--/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_status",
 "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 Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `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--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `status` | `string` | <!--source:api-specifications-->Status of the query execution<!--/source--> |
| `result_csv_file` | `string` | <!--source:api-specifications-->URL for query result in CSV format<!--/source--> |
| `metrics` | `object[]` | <!--source:api-specifications-->Metrics<!--/source--> |
| `host_environment` | `string` | <!--source:api-specifications-->Environment host where the product is deployed.<!--/source--> |
| `product_api_identifier` | `string` | <!--source:api-specifications-->Unique identifier for payable unit<!--/source--> |
| `product_price_identifier` | `string` | <!--source:api-specifications-->Unique identifier for price<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `request_collection_id` | `string` | <!--source:api-specifications-->Unique identifier for Staircase request collection<!--/source--> |
| `response_collection_id` | `string` | <!--source:api-specifications-->Unique identifier for Staircase response collection<!--/source--> |
| `company_name` | `string` | <!--source:api-specifications-->Company name<!--/source--> |
| `price_unit_type` | `string` | <!--source:api-specifications-->The unit of the platform where the price evaluation can be determined as relevant<!--/source--> |
| `price_timing_type` | `string` | <!--source:api-specifications-->Price is included into billing based on this defined schedule.<!--/source--> |
| `price_amount` | `string` | <!--source:api-specifications-->Value of the unit in selected unit price. This value can be negative or positive.<!--/source--> |
| `price_amount_unit_type` | `string` | <!--source:api-specifications-->Unit of the price<!--/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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `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-->

### Aggregated Metric Migrations
<!--/source-->

`POST` `/migrations`

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

#### Create Aggregated Finance Metric Migration Configurations
<!--/source-->

`createFinanceMigrationConfigurations`

<!--source:api-specifications-->
Create Finance Migration Configurations
<!--/source-->

<!--source:api-specifications-->
This service creates migration configurations to allow migrating aggregated finance data to another environment. Aggregated finance data is needed for generating finance reports from them.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "migration_configuration_name": "test_name",
 "target_environment_api_key": "apikey",
 "target_environment_domain": "documentation.staircaseapi.com"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html403404
<!--/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-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `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 |
| --- | --- | --- |
| `migration_configuration_name`required | `string` | <!--source:api-specifications-->Migration configuration name<!--/source-->Example `test-migration` |
| `target_environment_domain`required | `string` | <!--source:api-specifications-->Domain of target environment<!--/source-->Example `documentation.staircaseapi.com` |
| `target_environment_api_key`required | `string` | <!--source:api-specifications-->API key of given target environment<!--/source-->Example `1111111-22222-333333` |

##### 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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

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

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

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

`GET` `/migrations`

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

#### List Aggregated Finance Metric Migration Configurations
<!--/source-->

`listFinanceMigrationConfigurations`

<!--source:api-specifications-->
List Finance Migration Configurations
<!--/source-->

<!--source:api-specifications-->
This service allows retrieving Finance product migration configuration

<!--/source-->

##### Response

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

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

```
{
 "migration_configurations": [
 {
 "migration_configuration_name": "test_name",
 "target_environment_api_key": "apikey",
 "target_environment_domain": "template.staircaseapi.com"
 }
 ]
}
```

<!--/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 Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `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 |
| --- | --- | --- |
| `migration_configurations` | `object[]` | <!--source:api-specifications-->Configurations<!--/source--> |
| `migration_configuration_name` | `string` | <!--source:api-specifications-->Unique configuration name<!--/source-->Example `test_configuration` |
| `target_environment_api_key` | `string` | <!--source:api-specifications-->Target environment API key<!--/source-->Example `111111-222222-333333` |
| `target_environment_domain` | `string` | <!--source:api-specifications-->Target environment domain<!--/source-->Example `documentation.staircaseapi.com` |

##### 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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

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

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

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

`PUT` `/migrations/{migration_configuration_name}`

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

#### Update Aggregated Finance Metric Migration Configurations
<!--/source-->

`updateFinanceMigrationConfigurations`

<!--source:api-specifications-->
Update Finance Migration Configurations
<!--/source-->

<!--source:api-specifications-->
This service updates migration configuration.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "target_environment_api_key": "apikey",
 "target_environment_domain": "documentation.staircaseapi.com"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400 application/json400 text/html403404
<!--/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-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `migration_configuration_name` required | `string` path | `test_configuration_name` | <!--source:api-specifications-->Unique configuration name<!--/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 |
| --- | --- | --- |
| `target_environment_domain`required | `string` | <!--source:api-specifications-->Domain of target environment<!--/source-->Example `documentation.staircaseapi.com` |
| `target_environment_api_key`required | `string` | <!--source:api-specifications-->API key of given target environment<!--/source-->Example `1111111-22222-333333` |

##### 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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

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

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

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

`GET` `/migrations/{migration_configuration_name}`

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

#### Get Aggregated Finance Metric Migration Configurations
<!--/source-->

`getFinanceMigrationConfigurations`

<!--source:api-specifications-->
Get Finance Migration Configurations
<!--/source-->

<!--source:api-specifications-->
This service allows retrieving Finance product migration configuration

<!--/source-->

##### Response

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

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

```
{
 "migration_configuration_name": "test_name",
 "target_environment_api_key": "apikey",
 "target_environment_domain": "documentation.staircaseapi.com"
}
```

<!--/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 Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `migration_configuration_name` required | `string` path | `test_configuration_name` | <!--source:api-specifications-->Unique configuration name<!--/source--> |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `migration_configuration_name` | `string` | <!--source:api-specifications-->Unique configuration name<!--/source-->Example `test_configuration` |
| `target_environment_api_key` | `string` | <!--source:api-specifications-->Target environment API key<!--/source-->Example `111111-222222-333333` |
| `target_environment_domain` | `string` | <!--source:api-specifications-->Target environment domain<!--/source-->Example `documentation.staircaseapi.com` |

##### 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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

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

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

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

`DELETE` `/migrations/{migration_configuration_name}`

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

#### Delete Aggregated Finance Metric Migration Configurations
<!--/source-->

`deleteFinanceConfigurations`

<!--source:api-specifications-->
Delete Finance Configurations
<!--/source-->

<!--source:api-specifications-->
This service allows deleting Finance product configuration

<!--/source-->

##### Response

<!--source:api-specifications-->
200400 error response400 text/html403404
<!--/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-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `migration_configuration_name` required | `string` path | `test_configuration_name` | <!--source:api-specifications-->Unique configuration name<!--/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 |
| --- | --- | --- |
| `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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

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

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

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

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

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

`POST` `/reports/finance`

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

#### Create Finance Metric Reports
<!--/source-->

`createFinanceMetricReport`

<!--source:api-specifications-->
Create Finance Metric Report
<!--/source-->

<!--source:api-specifications-->
This service allows the creation of financial reports for given dates. Request body allows filtering reports by some fields. This service starts asynchronous report execution and returns a unique report ID for checking report execution status and getting report results if report execution is finished.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "product_api_identifiers": [
 "id_1",
 "id_2"
 ],
 "product_price_identifiers": [
 "product_price_identifier_1",
 "product_price_identifier_2"
 ],
 "start_date": "2021-04-13",
 "end_date": "2021-05-13"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Report execution started

```
{
 "report_id": "9a6aa8-4f2-400d-9451-e1e127485"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Bad request syntax or missed a required field

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Unauthorized, Bad credentials.

```
{
 "message": "Unauthorized, Bad credentials."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Method not allowed.

```
{
 "message": "The method is not allowed for the requested URL"
}
```

<!--/source-->

##### Parameters

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

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

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

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

| Field | Type | Description |
| --- | --- | --- |
| `product_api_identifiers` | `array` | <!--source:api-specifications-->List of API ID<!--/source--> |
| `product_price_identifiers` | `array` | <!--source:api-specifications-->List of product price identifier<!--/source--> |
| `price_amount_unit_type` | `string` | <!--source:api-specifications-->Price unit<!--/source-->`cents`Example `cents` |
| `start_date`required | `string` | <!--source:api-specifications-->Start date in ISO8601 format<!--/source-->Example `2021-04-13` |
| `end_date`required | `string` | <!--source:api-specifications-->End date in ISO8601 format<!--/source-->Example `2021-05-13` |

##### Response `202``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Report execution started
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report_id` | `string` | <!--source:api-specifications-->Report ID<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Bad request syntax or missed a required field
<!--/source-->

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

##### Response `401``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Unauthorized, Bad credentials.
<!--/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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `405``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Method not allowed.
<!--/source-->

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

##### Other responses

`422`

`POST` `/reports/finance/aggregated`

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

#### Create Aggregated Finance Metric Reports
<!--/source-->

`createAggregatedFinanceMetricReport`

<!--source:api-specifications-->
Create Aggregated Finance Metric Report
<!--/source-->

<!--source:api-specifications-->
This service allows the creation of financial reports from aggregated metric data for given dates. In order to get a finance report for multiple environments, please have a look at the migrations(/migrations) service for migrating aggregated finance metrics. Request body allows filtering reports by some fields. This service starts asynchronous report execution and returns a unique report ID for checking report execution status and getting report results if report execution is finished. There is no retention period for aggregated finance metrics.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "product_api_identifiers": [
 "id_1",
 "id_2"
 ],
 "environments": [
 "documentation.staircaseapi.com"
 ],
 "product_price_identifiers": [
 "product_price_identifier_1",
 "product_price_identifier_2"
 ],
 "start_date": "2021-04-13",
 "end_date": "2021-05-13"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Report execution started

```
{
 "report_id": "9a6aa8-4f2-400d-9451-e1e127485"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Bad request syntax or missed a required field

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Unauthorized, Bad credentials.

```
{
 "message": "Unauthorized, Bad credentials."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Bad request syntax or forbidden request

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Method not allowed.

```
{
 "message": "The method is not allowed for the requested URL"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `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 |
| --- | --- | --- |
| `product_api_identifiers` | `array` | <!--source:api-specifications-->List of API ID<!--/source--> |
| `environments` | `array` | <!--source:api-specifications-->List of environment names<!--/source--> |
| `product_price_identifiers` | `array` | <!--source:api-specifications-->List of product price identifier<!--/source--> |
| `price_amount_unit_type` | `string` | <!--source:api-specifications-->Price unit<!--/source-->`cents`Example `cents` |
| `start_date`required | `string` | <!--source:api-specifications-->Start date in ISO8601 format<!--/source-->Example `2021-04-13` |
| `end_date`required | `string` | <!--source:api-specifications-->End date in ISO8601 format<!--/source-->Example `2021-05-13` |

##### Response `202``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Report execution started
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `report_id` | `string` | <!--source:api-specifications-->Report ID<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Bad request syntax or missed a required field
<!--/source-->

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

##### Response `401``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Unauthorized, Bad credentials.
<!--/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-->
Bad request syntax or forbidden request
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `405``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Method not allowed.
<!--/source-->

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

##### Other responses

`422`

`GET` `/reports/{report_id}`

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

#### Get Finance Report Result
<!--/source-->

`getFinanceReportResult`

<!--source:api-specifications-->
This service retrieves the status of a Report Execution for a given report_id. Status = IN_PROGRESS, SUCCEEDED, or FAILED. Continue to ping this service until you receive a status = SUCCEEDED or FAILED. Created report results have one month retention period.

<!--/source-->

##### Response

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

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

```
{
 "report_id": "979a6aa8-4f2-400d-9451-80ee1e127485",
 "status": "SUCCEEDED",
 "created_at": "2022-05-06:11:53:38",
 "finished_at": "2022-05-06:11:55:10",
 "expired_at": "1654864684",
 "report_data": {
 "total": 0,
 "price_amount_unit_type": "cents",
 "environments": []
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Bad request syntax or missed a required field

```
{
 "message": "Bad request syntax or missed a required field"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Method not allowed.

```
{
 "message": "The method is not allowed for the requested URL"
}
```

<!--/source-->

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

```
{
 "message": "Not found."
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Method not allowed.

```
{
 "message": "The method is not allowed for the requested URL"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `<redacted>` | <!--source:api-specifications-->API key<!--/source--> |
| `report_id` required | `string` path | `979a6aa8-4f2-400d-9451-80ee1e127485` | <!--source:api-specifications-->Report ID<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `report_id` | `string` | <!--source:api-specifications-->Report ID<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->IN_PROGRESS, FAILED, or SUCCEEDED<!--/source-->`FAILED``IN_PROGRESS``SUCCEEDED` |
| `report_data` | `object` | <!--source:api-specifications-->Report payload<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->Create date of report execution<!--/source-->Example `2022-05-06:11:53:38` |
| `finished_at` | `string` | <!--source:api-specifications-->Finish date of report execution<!--/source-->Example `2022-05-06:11:55:10` |
| `expired_at` | `string` | <!--source:api-specifications-->Expiration timestamp in string format<!--/source-->Example `1654864684` |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Bad request syntax or missed a required field
<!--/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-->
Method not allowed.
<!--/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 |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `405``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Method not allowed.
<!--/source-->

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

##### Other responses

`422`

## Errors

`400``401``403``404``405``422``504`

## More in Distribution

- Previous product: Environment
- Next product: Host
