Skip to main content
POST
/
compute
/
functions
Create a function
curl --request POST \
  --url https://api.quiva.ai/compute/functions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "my-function",
  "description": "A serverless function",
  "compute_asset": {
    "collection_topic": "my-namespace",
    "handler": "index.handler",
    "assets": [
      {
        "asset_name": "index.js",
        "asset_type": "file",
        "asset_value": "Y29uc29sZS5sb2coIkhlbGxvLCBXb3JsZCEiKTsK",
        "link": false
      }
    ],
    "timeout": 30000,
    "read_only_fs": true
  },
  "monitor_config": {
    "ttl": 604800000,
    "store_payload": true
  },
  "schema": {
    "input": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      }
    },
    "output": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
'
{
  "body": {
    "description": "A serverless function",
    "name": "my-function",
    "runtime": "nodejs",
    "subject": "ms.compute.my-namespace.function.123456789",
    "type": "created",
    "modified": 1714378974,
    "compute_asset": {
      "collection_topic": "my-namespace",
      "service": "123456789",
      "runtime": "nodejs",
      "handler": "index.handler",
      "timeout": 30000,
      "read_only_fs": true
    },
    "monitor_config": {
      "ttl": 604800000,
      "store_payload": true
    },
    "schema": {
      "input": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "output": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Function to create

name
string
required

Function name

compute_asset
object
required
monitor_config
object
required
description
string

Function description

schema
object
size
string

Size configuration for function resources

Response

Function created successfully

body
object