API
The Attio client SDK provides a typesafe way to query record data via GraphQL. There are two main functions for this. Which you choose to use is a design decision of your app.runQuery
An imperative asynchronous function to query record data.
useQuery
A suspenseful hook to query record data.
Writing GraphQL Queries
When you runnpx attio dev to develop your app, you will be prompted to
Press "o" to open GraphQL Explorer.. If you do press o, it will open an
instance of
GraphiQL.
GraphiQL will help you explore the schema as well as autocomplete your query as you type.
The GraphiQL instance is not hooked up to any data source!Pressing the ▶️ button to execute the query will return 
null if there are no errors.Query composing example

Example Queries
Get information about the current user
Get information about the current user
Get email addresses for the current person record
Get email addresses for the current person record
Get the names and email addresses of people at the current company record
Get the names and email addresses of people at the current company record
TypeScript Code-Gen
runQuery() and useQuery() will accept just a string as your query, but if you write your
query in a separate file with the .graphql or .gql extension, you can then import your
query into your TypeScript file. If you pass the imported query to these functions, your results
will be strongly typed. The code generator will look for query files as long as you are runnning
npx attio dev.
Let’s look at an example:
Custom Attributes
Custom attributes can be loaded via GraphQL with their slug. The slug can be found under the kebab menu for the custom attribute in Workspace Settings.
get-bluesky.graphql
You must include 
__typename and the ... on syntax to match the type of the attribute you are
querying.__typename before reading the value.
Advanced Usage
Fragments
Some queries can return multiple types of objects. The way this is handled in GraphQL is with fragments and by querying__typename and then switching on its value.
The record query takes a record id and an object type and returns the matching object.
Those variables happen to be exactly what the onTrigger() function on our
record action is given.

