API Pricing and Consumption
This page explains the pricing plans for our GraphQL API and provides examples of query complexity consumption. It also describes how the API reacts when the daily and monthly limits are reached.
Plans
Our GraphQL API offers three pricing plans to cater to different use cases and requirements:
Plan | Fixed Cost | Consumption Cost | Access |
---|---|---|---|
Basic | To be disclosed* | To be disclosed* | Read-only access to aggregated site data on a daily, monthly, and yearly level |
Professional | To be disclosed* | To be disclosed* | Read-only access to aggregated site data on a minutely, hourly, daily, monthly, and yearly level |
Enterprise | To be disclosed* | To be disclosed* | Read-only access to aggregated site and device data on a minutely, hourly, daily, monthly, and yearly level |
*Please contact support@solytic.com for more information about the pricing details.
Query Complexity Consumption
Consumption Units and Query Complexity
A consumption unit is a measure used to determine the cost of executing a GraphQL query. In our API, a consumption unit is equivalent to a complexity value of 1. The total consumption units for a query are calculated by summing the complexities of each field within the query, taking into account pagination multipliers. This helps you understand the cost of a query and allows you to optimize and manage your API usage more efficiently.
Fields in a query have varying costs, depending on their complexity and the amount of data they return. Pagination acts
as a multiplier for query complexity. For example, if you fetch one item in the pagination, the cost will be x
, but if
you fetch 10 items, the cost will be x
times 10.
Keep in mind that the complexity cost calculation is based on the requested pagination size, even if fewer items are returned than requested. For instance, if you request 10 items but only 3 are returned, the complexity cost will still be calculated for 10 items. This is because the query has the potential to request up to 10 devices. To ensure cost-efficiency, it is essential to optimize your queries based on the number of items you expect to retrieve. See API Usage: Pagination for more details.
Field Costs Breakdown
In our GraphQL API, various field types have different complexity costs. The breakdown of costs associated with each field type is as follows:
General
- Base Field: 1
- Regular fields, such as strings, integers, and enums, have a cost of 1.
- Example: fetching the field
name
in the entitysite
- Entity Loading: 5
- When an entity is loaded from within another entity or accessed for the first time, it has a cost of 5. This higher cost accounts for the additional queries that need to be executed in the background to retrieve the requested data.
- Example: fetching the entity
site
, or fetching the fieldaddress
from within the entitysite
Individual Costs
For certain fields, individual costs will be assigned to account for the increased resource usage.
Data Granularity Fields
You can choose the granularity in which you want to receive the data of a certain type, e.g.
device.data.acActivePower.tenMinutes
or site.data.acInverterYield.daily
. Here you can find the cost for each
granularity:
- raw: 40
- minute: 40
- tenMinutes: 40
- fifteenMinutes: 40
- thirtyMinutes: 40
- hourly: 20
- daily: 10
- weekly: 10
- monthly: 10
- quarterly: 10
- yearly: 10
Viewing Complexity Cost
To view the complexity cost of a GraphQL query, check the response headers after making a request.
The graphql-request-cost
field in the response header contains the complexity cost of the executed query.
Every valid GraphQL query will return the graphql-request-cost
header with a numeric value representing the complexity
cost of the query. You can inspect this value in the response headers of the GraphQL API response to better understand
the cost associated with each query you make.
By keeping track of the complexity cost of your queries, you can optimize them to stay within the consumption limits of your API plan and minimize the impact on your application's performance.
Example Queries
The following section provides example queries to help illustrate how query complexity consumption works.
Simple Query
query ExampleQuery {
sites(first: 1) { # cost: 5, pagination: 1
nodes { # cost: 1
eid # cost: 1
name # cost: 1
}
}
}
In the example above, each field has a specific cost associated with it (indicated in the comments). The total cost of the query is the sum of the costs of each field, multiplied by the number of items fetched in the pagination.
For this example, the total cost to fetch one site, including its eid
and name
, would be 8. Since the pagination is
fetching only one item, the multiplier is 1.
The calculation is: 8 * 1 = 8
Increasing Pagination
query ExampleQuery {
sites(first: 10) { # cost: 5, pagination: 10
nodes { # cost: 1
eid # cost: 1
name # cost: 1
}
}
}
With a higher pagination value, the calculation becomes: 8 * 10 = 80
Adding More Fields
If we include more fields, then the cost increases:
query ExampleQuery {
sites(first: 10) { # cost: 5, pagination: 10
nodes { # cost: 1
eid # cost: 1
name # cost: 1
address { # cost: 5
city # cost: 1
}
}
}
}
When including more fields, the calculation is: 14 * 10 = 140
Nested Pagination
query ExampleQuery {
sites(first: 10) { # cost: 5, pagination: 10
nodes { # cost: 1
eid # cost: 1
name # cost: 1
devices(first: 10) { # cost: 5, pagination: 10
nodes { # cost: 1
eid # cost: 1
}
}
}
}
}
When fetching a paginated list of items within an already paginated list, the calculation is: (8 + (7 * 10)) * 10 = 780
Explanation:
- 8 is the sum of
sites
,nodes
,eid
, andname
- 7 is the sum of
devices
,nodes
, andeid
- 10 is the multiplier for the
devices
list - 10 is the multiplier for the
sites
list
Including data
fields
query EXAMPLE_QUERY {
devices(first: 20) { # cost: 5, pagination: 20
nodes { # cost: 1
eid # cost: 1
data { # cost: 1
acActivePower { # cost: 1
fifteenMinutes { # cost: 40
dataPoints { # cost: 5
value # cost: 1
timestamp # cost: 1
}
}
}
}
}
}
}
The granularity field fifteenMinutes
has a higher complexity due to a higher resource usage.
The calculation: (5 + 1 + 1 + 1 + 1 + 40 + 5 + 1 + 1) * 20 = 1120
If you run this query every 15 minutes for 31 days, then it would be run 2976 times, which would roughly cost 3.33 €:
1120 * 2976 * 0.000001 = 3.33 €
API Limits
Every request allows a maximum complexity of 50,000. If you go beyond this, you will receive a GraphQL error informing you of this limit.
The daily and monthly consumption limits for each plan are currently being defined. Once the limits are set, the API will block an application when the daily or monthly limit is reached.
This section will be updated soon with more concrete information