Functions API reference
Reference documentation for the Sanity Functions HTTP endpoints.
Authentication
- All requests must be authenticated.
Base API server URL
Production External API
https://api.sanity.ioFunctions
Retrieve function logs
/{apiV}/functions/{functionId}/logsBy default, this route returns a list of the last 100 log entries. To get a different set of items, you can use the offset and limit parameters in the query string of the GET request.
Path parameters
The ID of the resource
Query parameters
- executionIdstring
Durable Function execution ID.
Set to "false" to omit the "Message sent to queue" system log entries emitted when a message is enqueued for a queue function.
The maximum number of logs to retrieve.
The offset, from the last log entry, to begin retrieval.
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Responses
Logs retrieve
- Example:
1 Show child attributes
items
- attemptinteger
Optional Durable step attempt positive number, if the log came from a Durable step operation
Example:1 - executionIdstring
Durable Function execution ID.
Example:1%2Fdurable-execution%2Fa5f104bf-8f98-4c43-a275-c47cd0e55c91%2F721704c1-73ae-3004-95fa-f472e130fb15 - levelstring | null
- Example:
This is probably something important - operationIdstring
Optional unique Durable step ID, if the log came from a Durable step operation
Example:c81e728d9d4c2f63 - operationNamestring
Optional non-unique Durable step name, if the log came from a named Durable step operation
Example:flip-coin - Example:
c19d92ea-f3c1-4fc1-a2a4-7d7e08527584 - Example:
"2025-10-09T10:50:09.486Z"
- nextstringExample:
/vX/functions/123456/logs?limit=1&offset=2 - Example:
1 - prevstringExample:
/vX/functions/123456/logs?limit=1&offset=0
Delete logs for a function
/{apiV}/functions/{functionId}/logsPath parameters
The ID of the resource
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Stream function logs
/{apiV}/functions/{functionId}/logs/streamPath parameters
The ID of the resource
Query parameters
- afterstring (date-time)
ISO 8601 timestamp to stream from, exclusive. Defaults to the newest entry at connect time, so only new logs are sent. Ignored when
Last-Event-IDis present. Set to "false" to omit the "Message sent to queue" system log entries emitted when a message is enqueued for a queue function.
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Responses
Invoke a function
/{apiV}/functions/{functionId}/invokePath parameters
The ID of the resource
Query parameters
- syncdefault:
falseWhether to invoke functions synchronously, defaults to false.
Header parameters
Resource ID
Type of resource (i.e. project or organization)
- x-sanity-lineagestring
The lineage token of the request
Responses
Function Invoked
- schema | null
Function Invoked Asynchronously - No Content
Function Invoked - No Content
List functions
/{apiV}/functionsPath parameters
Query parameters
- includeProjectsdefault:
falseWhen true and the request is organization scoped, include functions for all projects under the organization
- regionstring
The region of the deployed resource
- statusstring
State of function
- statusesstring
Comma separated list of statuses to filter by. Takes precedence over
statuswhen both are provided.
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Responses
List of functions
Show child attributes
items
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.appUNIX Cron expression
Show child attributes
Timezone to execute the scheduled function in
Example:Canada/NewfoundlandDate resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Show child attributes
- debounceobject | null
Collapse bursts of events for the same key into one invocation. The function is invoked once per quiet period with the most recent event; earlier events in the window are dropped, not batched.
Example{"key":"event.data.documentId","maxWindow":300,"window":60} - maxAttemptsinteger | null
Total delivery attempts.
1delivers a message once and never retries,3delivers it once and retries twice. Omit or sendnullfor redelivery until the queue retention period expires.Example:3
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.appDate resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Total Durable function timeout, from start of execution to finish, including sleep time
Example:86400Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Read a function
/{apiV}/functions/{functionId}Path parameters
The ID of the resource
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Responses
Function
- funcrequired
Show child attributes
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.appUNIX Cron expression
Show child attributes
Timezone to execute the scheduled function in
Example:Canada/NewfoundlandDate resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Show child attributes
- debounceobject | null
Collapse bursts of events for the same key into one invocation. The function is invoked once per quiet period with the most recent event; earlier events in the window are dropped, not batched.
Example{"key":"event.data.documentId","maxWindow":300,"window":60} - maxAttemptsinteger | null
Total delivery attempts.
1delivers a message once and never retries,3delivers it once and retries twice. Omit or sendnullfor redelivery until the queue retention period expires.Example:3
Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.appDate resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
Date resource was deleted
Example:"2021-07-01T12:00:00.000Z"The human-readable name of the function
Example:Log SweeperThe ID of the resource
Example:abcd123456Memory allocated to function
Example:256The unique name of the blueprint resource
Example:log-sweeperResource ID
Example:24s6f8srType of resource (i.e. project or organization)
Example:projectRobot Token ID
Example:g-qS7j8qb0uvL4Runtime for function
Example:nodejs24.xState of function
Example:assignedEphemeral storage allocated to function in MB
Example:512Timeout for function in seconds
Example:60Function invocation URL
Example:https://my-function-123456-uc.a.run.app- contentSubdefault:
{}Show child attributes
- createdAtstring
Show child attributes
- eventrequired
Show child attributes
- apiVersionstring
- filterstring
Show child attributes
items
- stringenum:
"create", "update", "delete"
- projectionstring
- filterrequired
Show child attributes
- updatedAtstring
Total Durable function timeout, from start of execution to finish, including sleep time
Example:86400Date resource was created
Example:"2021-07-01T12:00:00.000Z"Date resource was last updated
Example:"2021-07-01T12:00:00.000Z"
List environment variable keys
/{apiV}/functions/{functionId}/envvarsPath parameters
The ID of the resource
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Update an environment variable
/{apiV}/functions/{functionId}/envvars/{envVarKey}Path parameters
The key of the environment variable
The ID of the resource
Header parameters
Resource ID
Type of resource (i.e. project or organization)
Request body application/json
Delete an environment variable
/{apiV}/functions/{functionId}/envvars/{envVarKey}Path parameters
The key of the environment variable
The ID of the resource
Header parameters
Resource ID
Type of resource (i.e. project or organization)