Home / Basics / Highnote API

Request Complexity

Request complexity calculation

Request complexity only applies to Highnote’s GraphQL API.

The Highnote API calculates request complexity differently based on whether you send a query or mutation to the API.

  • Query: Query cost is based on the types and fields requested.
  • Mutation: Mutations have a base cost of 10, plus any additional costs based on the types and fields requested.

Type and field cost values

The cursor and pageInfo fields of a request cost zero points because they are a result of connection objects.

The following table represents each type or field used in a request and its associated cost:

Type/FieldDescriptionCost
ObjectsObjects represent data that consists of multiple fields.One point
Interfaces and unionsInterfaces and unions function similarly to objects in GraphQL, as they allow for returning multiple types of data. Because interfaces and unions can return multiple types of data, only the most expensive type requested is counted.One point
Scalars and enumsScalars are types that return a final value, such as strings, integers, and IDs. Enums return one of a predefined set of values. Scalars and enums have minimal cost since they are already accounted for in the object they belong to, so no extra lookups are needed.Zero points
ConnectionsConnections represent relationships between different data entities. They allow you to define how different types of data are connected and how they can be queried.Two points plus the number of objects requested

Example 1

The following example demonstrates a simple request complexity calculation:

Example 1
query ListCardProducts {
  cardProducts(first: 10) {
    # Connection 2 + 10 items
    pageInfo {
      # PageInfo object 0 point
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
    }
    edges {
      # Edges field - 0 point
      cursor # String - 0 point
      node {
        # Node field in connection - 0 point
        id # String - 0 point
        name # String - 0 point
        vertical # String - 0 point
        features {
          # Object - 1 point
          enabled # Boolean - 0 point
        }
      }
    }
  }
}
Request Calculation
2 + 10(1)  

Example 2

The following example demonstrates a more complex request complexity calculation that includes nested connection objects to illustrate how pagination cost can multiply:

Example 2
query LookupStatement($id: ID!) {
  node(id: $id) {
    # Object 1 point
    ... on SecuredDepositCommercialCreditCardFinancialAccountStatement {
      statementEntries(first: 20) {
        # Connection 2 + 20 items
        edges {
          # Edges field - 0 point
          node {
            # Node field in connection - 0 point
            ledgerEntry {
              # Object - 1 point
              __typename # String - 0
              id # ID - 0 point
              ledger {
                # Object - 1 point
                ledgerEntries(first: 20) {
                  # Connection 2 + 20 items
                  edges {
                    # Edges field - 0 point
                    node {
                      # Node field in connection - 0 point
                      amount {
                        # 1 Object - 1 point
                        value # 0 UnsignedInt - 0 point
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
Request Calculation
1 + 2 + 20(1 + 1 + 2 + 20(1)) = 483

Request cost in GraphQL responses

Request cost information is included in API responses under the extensions field. We recommend testing a query or mutation of your choosing using the API Explorer to examine the request’s cost.

The following example represents a request cost response in an API request that is not rate-limited:

Query Cost Response
{
  "data": {},
  "errors": {},
  "extensions": {
    "rateLimit": {
      "limit": 100,
      "cost": 5,
      "remaining": 95
    }
  }
}

Provide Feedback

Was this content helpful?