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 are sending 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 for 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?