apiVersion
- Type:
string | ((params: CallbackParams & { childOptions: ChildResolverOptions }) => string) - Optional: Yes
The apiVersion property allows you to specify the Sanity API version for a specific list item.
Standard Usage
ts
{
schemaType: 'author',
apiVersion: '2025-02-19',
}ts
helpers.listing('author', {
apiVersion: '2025-02-19',
});Dynamic API Version (Callback)
You can specify the apiVersion dynamically using a callback function:
ts
{
schemaType: 'author',
apiVersion: ({ workspace }) => workspace === 'production' ? '2026-06-19' : '2025-02-19',
}ts
helpers.listing('author', {
apiVersion: ({ workspace }) => (workspace === 'production' ? '2026-06-19' : '2025-02-19'),
});