> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/hygraph.md).

# Hygraph

Connect to Hygraph, a GraphQL headless CMS, to list content models and read, create, update, publish, and unpublish entries.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication       |
| --------- | -------------------- |
| Hygraph   | Permanent Auth Token |

#### Hygraph

Connect to a Hygraph project with a Permanent Auth Token to list content models, and read, create, update, publish, and unpublish entries.

**Set up in Hygraph**

1. Prepare the Hygraph account or service that the workflow will access. Grant access to the required resources and operations.
2. **Content API Endpoint:** The project's read/write Content API URL from Project Settings > Endpoints, e.g. <https://api-eu-central-1.hygraph.com/v2/\\><projectId>/master. Do not use the High Performance read-only endpoint (cdn.hygraph.com/content/...): it rejects creates, updates, and publishing. Must be a hygraph.com or graphcms.com address.
3. **Permanent Auth Token:** Create at Project Settings > API Access > Permanent Auth Tokens. Grant Read plus Create/Update/Delete/Publish/Unpublish on the models this connection will use.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Hygraph**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field        | Required | What to enter                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Content API Endpoint | Yes      | The project's read/write Content API URL from Project Settings > Endpoints, e.g. <https://api-eu-central-1.hygraph.com/v2/\\><projectId>/master. Do not use the High Performance read-only endpoint (cdn.hygraph.com/content/...): it rejects creates, updates, and publishing. Must be a hygraph.com or graphcms.com address. [Provider instructions](https://hygraph.com/docs/getting-started/access-and-permissions/api-access). |
| Permanent Auth Token | Yes      | Create at Project Settings > API Access > Permanent Auth Tokens. Grant Read plus Create/Update/Delete/Publish/Unpublish on the models this connection will use. [Provider instructions](https://hygraph.com/docs/api-reference/basics/authorization).                                                                                                                                                                               |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Hygraph** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### List Models

List the content models in your Hygraph project, such as Post or Product.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field  | Type          | Description                        |
| ------ | ------------- | ---------------------------------- |
| Models | object\_array | Content models with their API ids. |

#### Get Model Fields

See the fields of a model, their types, and which are required.

**Inputs**

| Field | Type            | Required | Description                                                              |
| ----- | --------------- | -------- | ------------------------------------------------------------------------ |
| Model | select (string) | Yes      | The content model to inspect. Options load from the selected connection. |

**Outputs**

| Field  | Type          | Description                   |
| ------ | ------------- | ----------------------------- |
| Model  | string        | The model that was inspected. |
| Fields | object\_array | The model's fields.           |

#### List Entries

Find entries of a model, optionally matching a search term or filter.

**Inputs**

| Field                 | Type            | Required | Description                                                                                                            |
| --------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Model                 | select (string) | Yes      | The content model to list entries from. Options load from the selected connection.                                     |
| Search                | string          | No       | Only return entries whose text contains this term.                                                                     |
| Content Stage         | select (string) | No       | Draft shows the latest edits; Published shows what is live. Options load from the selected connection. Default: DRAFT. |
| Show advanced options | boolean         | No       | Show locale, filter, sort order, and cursor options. Default: false.                                                   |
| Locale                | select (string) | No       | Return localized fields in this language. Options load from the selected connection.                                   |
| Filter (JSON)         | textarea        | No       | Advanced: a Hygraph where filter as JSON.                                                                              |
| Order By              | string          | No       | Sort order, e.g. newest first.                                                                                         |
| Max Results           | integer         | No       | Maximum number of entries to return. Minimum: 1. Maximum: 500. Default: 25.                                            |
| Cursor                | string          | No       | Continue from a previous result.                                                                                       |

**Outputs**

| Field       | Type          | Description                         |
| ----------- | ------------- | ----------------------------------- |
| Entries     | object\_array | Matching entries.                   |
| Next Cursor | string        | Pass this back to get more results. |
| Count       | integer       | Number of entries returned.         |

#### Get Entry

Get one entry by its ID.

**Inputs**

| Field         | Type            | Required | Description                                                                                                            |
| ------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Model         | select (string) | Yes      | The entry's content model. Options load from the selected connection.                                                  |
| Entry ID      | string          | Yes      | The ID of the entry.                                                                                                   |
| Content Stage | select (string) | No       | Draft shows the latest edits; Published shows what is live. Options load from the selected connection. Default: DRAFT. |
| Locale        | select (string) | No       | Return localized fields in this language. Options load from the selected connection.                                   |

**Outputs**

| Field | Type    | Description               |
| ----- | ------- | ------------------------- |
| Found | boolean | Whether the entry exists. |
| Entry | object  | The entry's fields.       |

#### Create Entry

Create a new entry, and optionally publish it right away.

**Inputs**

| Field                  | Type            | Required | Description                                                                                |
| ---------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------ |
| Model                  | select (string) | Yes      | The content model to create an entry in. Options load from the selected connection.        |
| Fields (JSON)          | textarea        | Yes      | The entry's field values as JSON.                                                          |
| Publish After Creating | boolean         | No       | Make the new entry live immediately. Default: false.                                       |
| Locale                 | select (string) | No       | Publish this locale along with the default one. Options load from the selected connection. |

**Outputs**

| Field     | Type    | Description               |
| --------- | ------- | ------------------------- |
| Entry     | object  | The created entry.        |
| Published | boolean | Whether it was published. |

#### Update Entry

Change fields on an existing entry, and optionally publish the change.

**Inputs**

| Field                   | Type            | Required | Description                                                                |
| ----------------------- | --------------- | -------- | -------------------------------------------------------------------------- |
| Model                   | select (string) | Yes      | The entry's content model. Options load from the selected connection.      |
| Entry ID                | string          | Yes      | The ID of the entry to change.                                             |
| Fields to Change (JSON) | textarea        | Yes      | Only the fields you want to change, as JSON.                               |
| Publish After Updating  | boolean         | No       | Make the change live immediately. Default: false.                          |
| Locale                  | select (string) | No       | Update and publish this locale. Options load from the selected connection. |

**Outputs**

| Field     | Type    | Description               |
| --------- | ------- | ------------------------- |
| Entry     | object  | The updated entry.        |
| Published | boolean | Whether it was published. |

#### Delete Entry

Permanently delete an entry from every stage.

**Inputs**

| Field    | Type            | Required | Description                                                           |
| -------- | --------------- | -------- | --------------------------------------------------------------------- |
| Model    | select (string) | Yes      | The entry's content model. Options load from the selected connection. |
| Entry ID | string          | Yes      | The ID of the entry to delete.                                        |

**Outputs**

| Field    | Type    | Description                   |
| -------- | ------- | ----------------------------- |
| Deleted  | boolean | Whether an entry was deleted. |
| Entry ID | string  | The ID that was deleted.      |

#### Publish Entry

Make an entry's latest draft live.

**Inputs**

| Field    | Type            | Required | Description                                                           |
| -------- | --------------- | -------- | --------------------------------------------------------------------- |
| Model    | select (string) | Yes      | The entry's content model. Options load from the selected connection. |
| Entry ID | string          | Yes      | The ID of the entry to publish.                                       |
| Locale   | select (string) | No       | Also publish this locale. Options load from the selected connection.  |

**Outputs**

| Field | Type   | Description          |
| ----- | ------ | -------------------- |
| Entry | object | The published entry. |

#### Unpublish Entry

Take an entry offline while keeping its draft.

**Inputs**

| Field    | Type            | Required | Description                                                            |
| -------- | --------------- | -------- | ---------------------------------------------------------------------- |
| Model    | select (string) | Yes      | The entry's content model. Options load from the selected connection.  |
| Entry ID | string          | Yes      | The ID of the entry to unpublish.                                      |
| Locale   | select (string) | No       | Only unpublish this locale. Options load from the selected connection. |

**Outputs**

| Field       | Type    | Description                          |
| ----------- | ------- | ------------------------------------ |
| Unpublished | boolean | Whether the entry was taken offline. |
| Entry ID    | string  | The entry's ID.                      |

#### Run GraphQL Query

Run any GraphQL query or mutation against your Hygraph Content API.

**Inputs**

| Field            | Type     | Required | Description                                  |
| ---------------- | -------- | -------- | -------------------------------------------- |
| GraphQL Query    | textarea | Yes      | The GraphQL query or mutation to run.        |
| Variables (JSON) | textarea | No       | Values for $variables in the query, as JSON. |

**Outputs**

| Field | Type   | Description       |
| ----- | ------ | ----------------- |
| Data  | object | The query result. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/hygraph.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
