---
title: "Named queries and parameters"
description: "GraphQL supports named queries and variables, enhancing query clarity. Example includes defining and utilizing variables for efficient data retrieval."
lang: en
languages:
  en: https://docs.vismasoftware.no/businessnxtapi/apireference/features/parameters/index.md
lastmod: 2026-07-10
---

> Documentation index: https://docs.vismasoftware.no/businessnxtapi/apireference/features/llms.txt


# Named queries and parameters

Last modified July 10, 2026

> GraphQL supports named queries and variables, enhancing query clarity. Example includes defining and utilizing variables for efficient data retrieval.


GraphQL supports variables and naming queries, which should always be used since they make the query more clear while reading.

Let's look at an example. In the following snippet, `GetCustomers` is a named query that returns a page associates. This query has three parameters: `$companyNo` specifies the Visma.net company number that uniquely identifies the company within the system, `$pageSize` the maximum number of records to be returned, and `$after` the cursor that indicates the position after which the records are to be fetched. If nothing is specified, this means the first `$pageSize` records are to be fetched.

```graphql
query GetCustomers($companyNo: Int, $pageSize: Int, $after :String)
{
  useCompany(no: $companyNo)
  {
    associate(first: $pageSize, after: $after)
    {
      totalCount
      pageInfo
      {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      items
      {
        associateNo
        customerNo
        name
      }
    }
  }
}
```

If you use GraphiQL, you can define the variables in the query variable pane in the lower left of the IDE, as shown in the following image:

![GraphiQL Query Variables](https://docs.vismasoftware.no/businessnxtapi/apireference/features/graphiqlvars.png)

When you perform the request to GraphQL programmatically, or from a tool that does not directly support GraphQL variables, you must put the request containing both the query and variables in the body, as `application/json`.

```json
{
  "query" : "query GetCustomers($cid: Int, $pageSize: Int, $after :String)\n{\n  useCompany(no: $cid)\n  {\n    associate(first: $pageSize, after: $after)\n    {\n      totalCount\n      items\n      {\n        associateNo\n        customerNo\n        name\n      }\n    }\n  }\n}",
  "variables":"{\"cid\": 1234567, \"pageSize\": 10, \"after\": \"MVx0MTAwMjA=\"}"
}
```

Details about the raw form of a GraphQL query were presented in an earlier section of this tutorial.

---

[View this page](https://docs.vismasoftware.no/businessnxtapi/apireference/features/parameters/)
