Skip to main content
GET
/
functions
/
{functionId}
Retrieve a function by its id
curl --request GET \
  --url https://{cluster}.cognitedata.com/api/v1/projects/{project}/functions/{functionId} \
  --header 'Authorization: Bearer <token>'
{
  "id": 4503599627370496,
  "createdTime": 123455234,
  "status": "Queued",
  "name": "myfunction",
  "fileId": 4503599627370496,
  "externalId": "my.known.id",
  "owner": "user@cognite.com",
  "description": "My fantastic function with advanced ML",
  "metadata": {},
  "secrets": {
    "MySecret": "***"
  },
  "functionPath": "myfunction/handler.py",
  "envVars": {
    "MyKey": "MyValue"
  },
  "cpu": 1,
  "memory": 1.5,
  "runtime": "py313",
  "runtimeVersion": "Python 3.11.10",
  "error": {
    "message": "Function deployment failed.",
    "trace": "ERROR: Could not find a version that satisfies the requirement pandas==99.0.0\nERROR: No matching distribution found for pandas==99.0.0"
  },
  "lastCalled": 1730204346000
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Path Parameters

functionId
integer
required

The function id.

Response

OK

id
integer<int64>
required

A server-generated ID for the object.

Required range: 1 <= x <= 9007199254740991
createdTime
integer<int64>
required

The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

Required range: x >= 0
Example:

123455234

status
enum<string>
required

Status of the function. It starts in a Queued state, is then Deploying before it is either Ready or Failed. If the function is Ready, it can be called.

Available options:
Queued,
Deploying,
Ready,
Failed
Example:

"Queued"

name
string
required

The name of the function.

Required string length: 1 - 140
Example:

"myfunction"

fileId
integer<int64>
required

The file ID to a file uploaded to Cognite's Files API. This file must be a zip file and contain a file called handler.py in the root folder (unless otherwise specified in the functionPath argument). This file must contain a function named handle with any of the following arguments: data, client, secrets and function_call_info, which are passed into the function. The zip file can contain other files as well (model binary data, libraries etc).

Custom packages can be pip installed by providing a requirements.txt file in the root of the zip file. The latest version of the Cognite Python SDK is automatically installed. If a specific version is needed, please specify this in the requirements.txt file.

Required range: 1 <= x <= 9007199254740991
externalId
string

The external ID provided by the client. Must be unique for the resource type.

Maximum string length: 255
Example:

"my.known.id"

owner
string

Owner of this function. Typically used to know who created it.

Maximum string length: 128
Example:

"user@cognite.com"

description
string

Description of the function.

Maximum string length: 500
Example:

"My fantastic function with advanced ML"

metadata
object

Custom, application specific metadata. String key -> String value. Limits: Maximum length of key is 32, value 512 characters, up to 16 key-value pairs. Maximum size of entire metadata is 4096 bytes.

secrets
object

Object with additional secrets as key/value pairs. These can e.g. password to simulators or other data sources. Keys must be lowercase characters, numbers or dashes (-) and at most 15 characters. You can create at most 30 secrets, all keys must be unique, and cannot be token, indexUrl, or extraIndexUrls. For each secret, the combined size of the secret name and secret value is limited by 25 kB. The secrets are returned scrambled if set.

Example:
{ "MySecret": "***" }
functionPath
string

Relative path from the root folder to the file containing the handle function. Defaults to handler.py. Must be on POSIX path format.

Maximum string length: 500
Example:

"myfunction/handler.py"

envVars
object

Object with environment variables as key/value pairs. Keys can contain only letters, numbers or the underscore character. You can create at most 100 environment variables.

Example:
{ "MyKey": "MyValue" }
cpu
number<float>

Number of CPU cores per function. Allowed range and default value are given by the limits endpoint. On Azure, only the default value is used.

Example:

1

memory
number<float>

Memory per function measured in GB. Allowed range and default value are given by the limits endpoint. On Azure, only the default value is used.

Example:

1.5

runtime
enum<string>
default:py313

The runtime of the function. For example, runtime "py313" translates to the latest version of the Python 3.13 series.

Available options:
py310,
py311,
py312,
py313
Example:

"py313"

runtimeVersion
string

The complete specification of the function runtime with major, minor and patch version numbers.

Example:

"Python 3.11.10"

error
object

Cognite Function API error.

lastCalled
integer<int64>

The last time the function was called, in milliseconds since epoch. Not present if the function has never been called.

Required range: x >= 0
Example:

1730204346000

Last modified on April 23, 2026