Functions API reference
Reference documentation for the Sanity Functions HTTP endpoints.
Authentication
- All requests must be authenticated.
Base API server URL
Staging External API
https://api.sanity.workProduction 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
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
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)
Responses
Logs deleted successfully
Stream function logs
/{apiV}/functions/{functionId}/logs/streamPath parameters
The ID of the resource
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
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
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
Date 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
Date 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)
Responses
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
Responses
The environment variable was updated successfully
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)
Responses
Environment Variable Deleted