Sanity
The Sanity Integration allows you to list, create and update posts on your Sanity.io site.
Last updated
Was this helpful?
The Sanity Integration allows you to list, create and update posts on your Sanity.io site.
Last updated
Was this helpful?
Generate an API Key
Go to your project Dashbaord on Sanity.io
Go to the API tab
Click on the "Add API Token" button
Set a name for your token (i.e. "AirOps")
Set the permissions as "Editor"
Click on "Save"
Copy the generated token
Add the API Key to AirOps
Go to AirOps > Settings > Integrations page
Click on the "Add New" and select Sanity
Paste the generated token in the API Key field
Click on "Save"
Security Note: Treat your API Key like a password. It provides REST API access to your Sanity instance, and it should not be shared. Store it securely and only use it in server-side or secure/authenticated environments.
Project ID: The ID of your Sanity project. (e.g. "w22x3y4z")
Dataset: The dataset you want to use. (e.g. "production")
Params: Extra parameters to use in the request. (Optional)
Fetches a list of resources from your Sanity project. This is useful for retrieving existing posts, images, or other content types. Returns 100 records per page.
Resource Type: The type of resource you want to list. (e.g. "post")
Last ID: To use pagination, you can set the last ID of the previous request. (Optional)
Fetches a single resource from your Sanity project. This is useful for retrieving detailed information about a specific post or image.
Array of blocks will be returned as is but a companion data structure will be returned with the blocks attributes converted to plain HTML within the __airops.html
JSON path.
Resource ID: The ID of the resource you want to fetch. (e.g. "4ddb0459-2734-4611-b1af-4ee13f3d5630")
Creates a new resource in your Sanity project. This is useful for adding new posts, images, or other content types.
Resource JSON: The JSON object representing the resource you want to create.
For instance: { "title": "My New Post", "category": "blog" }
When used in conjunction with the Resource HTML input, HTML attributes will be ignored from this input.
Resource HTML: A JSON object containing the resource attribute name as the key and the HTML document as value. (Optional)
For instance: { "body": "<h1>My New Post</h1><p>This is the content of my new post.</p>" }
This is useful for creating posts with rich text content.
The HTML will be converted to Sanity's Portable Text structure and used in the payload to create the resource. Send as many HTML attributes as needed.
Updates an existing resource in your Sanity project.
Resource ID: The ID of the resource you want to update. (e.g. "4ddb0459-2734-4611-b1af-4ee13f3d5630")
Resource JSON: The JSON object representing the resource you want to update.
For instance: { "title": "My Updated Post", "category": "blog" }
When used in conjunction with the Resource HTML input, HTML attributes will be ignored from this input.
Resource HTML: A JSON object containing the resource attribute name as the key and the HTML document as value. (Optional)
For instance: { "body": "<h1>My New Post</h1><p>This is the content of my new post.</p>" }
This is useful for creating posts with rich text content.
The HTML will be converted to Sanity's Portable Text structure and used in the payload to create the resource. Send as many HTML attributes as needed.
See .
See .