# GraphQL Schema

{% hint style="info" %}
The GraphQL API is an additional feature. If you would like to add the GraphQL Api to your Fast Weigh subscription, contact us at *865-219-2980* or <support@tacinsight.com>.
{% endhint %}

GraphQL provides a live schema via introspection of the API endpoint. That's a nerdy way of saying the available fields are always up to date and you don't have to worry about the documentation being stale!

## **How to View the Schema**

Head to the endpoint directly and hit "Browse Schema"

<figure><img src="/files/Usb1UZKp2fDmHNlZrvu8" alt=""><figcaption></figcaption></figure>

If you have already created a new "Document", you can also view the Schema by clicking the Schema button on the top-left of the screen (under the "Document" name)

## Making Sense of the Schema

GraphQL queries are based on "Types". These types are similar to a SQL Table. A "Customer" database table, for example, becomes a "Customer" type in GraphQL.

### **Root type**

First, you'll need to drill into a "root" type, two of which are available:

* `Query`
* `Mutation`

In the vast majority of cases, `Query` is what you're after. It's equivalent to a `SELECT` query in SQL.

The `mutation` is used to directly add/update/delete data via the API.

<figure><img src="/files/JZgSHWBYYDb3gAVGYbpf" alt=""><figcaption></figcaption></figure>

If you're following along, click into the `Query` to continue.

### **Exploring a GraphQL Type**

Inside the `Query` you'll see a list of available Types to explore.

<figure><img src="/files/Ol90lNLpruR9E5EHY72K" alt=""><figcaption></figcaption></figure>

Let's click into the Customer type `Customer` in purple.

<figure><img src="/files/u5uEghdGUyFj1ravUp11" alt=""><figcaption></figcaption></figure>

Here, you'll see a link to view the fields available on the Customer type.

<figure><img src="/files/6yJNpRp3zsM8pHclCftN" alt=""><figcaption></figcaption></figure>

If you go back to the Query types and find Customer again, you'll also see a `where` and `order` section under the main type

<figure><img src="/files/u5uEghdGUyFj1ravUp11" alt=""><figcaption></figcaption></figure>

This time, click the `CustomerFilterInput` in green.

Here, you will see a list of fields that can be passed into the type to filter the results returned.

<figure><img src="/files/kRa64HOzVpff30lf2saE" alt=""><figcaption></figcaption></figure>

If we select a filter input, we can see the exact filters that can be applied to that field. Let's select `address1`

Now, we can see every argument that can be used to filter the address 1 field

<figure><img src="/files/MidFJbD1WXtxNjyxGrgi" alt=""><figcaption></figcaption></figure>

For example, the `endsWith: String` input tells you that you can filter this field by how the string ends

```graphql
query getCustomerIdByAddress {
  customers(where: { address1: { endsWith: "st" } }) {
    customerID
    customerName
    address1
  }
}

```

{% hint style="info" %}
**Note that different field types contain different filter arguments!**&#x20;

For example, "String" accepts arguments like "contains", but an "Int" type does not. Conversely, "Int" accepts arguments like "gt" (Greater Than), but a "String" type does not.

Explore all of the different OperationFilterInput types to see what they accept!
{% endhint %}

Wiring queries and arguments/filters are covered further in our [GraphQL Query Crash Course](/fast-weigh-knowledge-base/references/api-documentation/graphql-v2-api/graphql-query-crash-course.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.tacinsight.com/fast-weigh-knowledge-base/references/api-documentation/graphql-v2-api/graphql-schema.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
