> For the complete documentation index, see [llms.txt](https://anilist.gitbook.io/anilist-apiv2-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anilist.gitbook.io/anilist-apiv2-docs/docs/guide/graphql/connections.md).

# Connections

Connection fields allow you to paginate through one-to-many or many-to-many relationships as well as access any intermediate data. All connections have 3 root fields: `edges`, `nodes`, and `pageInfo`.

## Edges

Edges are the intermediate data between the parent and child nodes. They are the relational link between the two, containing data pertaining to *how* the two are related along with a reference to the child node.

### Example

To help understand how these connections work, we'll use the relationship between `Media` and `Character` as an example.

An anime can have many characters, and a character can appear in many anime. These characters have a specific role in the anime (Main, Support, or Background) and they can have multiple voice actors in a single anime.

Neither the role nor the list ofvoice actors make sense to be stored in the `Character` object, so that connecting data lives on the `CharacterEdge` object.

```graphql
{
  Media {
    characters(page: 1) {
      edges { # Array of character edges
        role
        voiceActors { # Array of voice actors of this character for the anime
          id
          name {
            first
            last
          }
        }
      }
    }
  }
}
```

## Nodes

Nodes are the actual child data of the connection. You can access them with the `node` field on the edge object.

::: tip If you do not need to access any of the intermediate data, you can use the `nodes` field instead of `edges`. :::


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://anilist.gitbook.io/anilist-apiv2-docs/docs/guide/graphql/connections.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
