> For the complete documentation index, see [llms.txt](https://docs.rara.social/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rara.social/implementation/graphql-subgraph.md).

# GraphQL Subgraph

### GraphQL Subgraph&#x20;

* [theGraph Playground](https://thegraph.com/hosted-service/subgraph/rara-social/rara-social-curation-protocol)
* HTTP API&#x20;
  * <https://api.thegraph.com/subgraphs/name/rara-social/rara-social-curation-protocol> -&#x20;
* WebSocket API&#x20;
  * wss\://api.thegraph.com/subgraphs/name/rara-social/rara-social-curation-protocol

### Entity Definitions

* **Source**: a “Source” entity represents an external NFT that has been registered with the RARA protocol for use as a reaction.&#x20;
* **Transform**: a “Transform” entity represents a specific version of an external NFT that has been registered with the RARA protocol for use as a reaction. This concept allows for multiple versions of an external NFT to be represented in the RARA protocol.&#x20;
* **Reaction**: a “Reaction” entity represents a transform that has been purchased by a user to use as a reaction to a curated NFT.
* **UserReaction**: a “UserReaction” entity is a representation of a single reaction owned by a single user.&#x20;
* **UserSpend**: a “UserSpend” entity is a representation of a specific use of a reaction to a curated NFT by a user. This entity includes the user’s NFT exhibit tags and comments. ​​
* **CuratorVaultToken**: a “​​CuratorVaultToken” entity represents an external NFT that has been curated with the RARA protocol.
* **UserPosition**: a “UserPosition” entity represents a user’s balance in a specific ​​CuratorVaultToken&#x20;
* **UserEarning**: a “UserEarning” entity represents a single user’s royalty earnings.

### Contract Event Diagram&#x20;

This diagram illustrates the relationship between contract functions, contract events, and the graph entities:

* [Contract Event Diagram](https://docs.google.com/drawings/d/1KvYW_xUW6QL3wyIvNb-t4BnOA-fzm9zOwyiaoDrQr4E/edit?usp=sharing)

### Source Code

* [Schema](https://github.com/rara-social/rara-protocol/blob/main/subgraph/src/schema.graphql)
* Mappings
  * [MakerRegistrar](https://github.com/rara-social/rara-protocol/blob/main/subgraph/src/mapping/MakerRegistrar.ts)
  * [ReactionVault](https://github.com/rara-social/rara-protocol/blob/main/subgraph/src/mapping/ReactionVault.ts)
  * [CuratorVault](https://github.com/rara-social/rara-protocol/blob/main/subgraph/src/mapping/CuratorVault.ts)


---

# 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://docs.rara.social/implementation/graphql-subgraph.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.
