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
}Required capabilities:
functionsAcl:READ
Retrieve a function by its id. If you want to retrieve functions by names, use Retrieve functions instead.
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
}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.
The function id.
OK
A server-generated ID for the object.
1 <= x <= 9007199254740991The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 0123455234
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.
Queued, Deploying, Ready, Failed "Queued"
The name of the function.
1 - 140"myfunction"
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.
1 <= x <= 9007199254740991The external ID provided by the client. Must be unique for the resource type.
255"my.known.id"
Owner of this function. Typically used to know who created it.
128"user@cognite.com"
Description of the function.
500"My fantastic function with advanced ML"
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.
Show child attributes
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.
Show child attributes
{ "MySecret": "***" }Relative path from the root folder to the file containing the handle function. Defaults to handler.py. Must be on POSIX path format.
500"myfunction/handler.py"
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.
Show child attributes
{ "MyKey": "MyValue" }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.
1
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.
1.5
The runtime of the function. For example, runtime "py313" translates to the latest version of the Python 3.13 series.
py310, py311, py312, py313 "py313"
The complete specification of the function runtime with major, minor and patch version numbers.
"Python 3.11.10"
Cognite Function API error.
Show child attributes
The last time the function was called, in milliseconds since epoch. Not present if the function has never been called.
x >= 01730204346000
Was this page helpful?