Skip to content

Functions ​

Serverless functions: code, settings, deploys, test invocations, stats and logs. A function is also a service, so the service endpoints work on it.

Base URL: https://api.fjordrun.com. Generated from the OpenAPI document (API version 0.1.0).

Function runtimes and limits ​

GET /api/v1/functions/limits

Runtimes, memory sizes, defaults and limits for new functions, with the limits of each plan.

Authentication: a team API token or personal access token.

Response

200: JSON.

Example

bash
curl "https://api.fjordrun.com/api/v1/functions/limits" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Create a function ​

POST /api/v1/projects/{pid}/functions

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
pidpathstring (UUID)yes

Request body

FieldTypeRequiredDescription
runtime"node22", "python312"nodefault "node22"
entrystringnomax length 200, can be null
memory_mbintegernocan be null
timeout_sintegernocan be null
concurrencyintegernocan be null
max_replicasintegernocan be null
idle_timeout_sintegernocan be null
auth"public", "token"nocan be null
environment_idstring (UUID)yes
namestringnomax length 100, can be null
filesarray of FileInnomax 100 items, can be null
sourceGitHubSourceInnocan be null
deploybooleannodefault true

Response

201: a Function object.

Example

bash
curl -X POST "https://api.fjordrun.com/api/v1/projects/$PROJECT_ID/functions" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"environment_id":"00000000-0000-0000-0000-000000000000"}'

Get a function ​

GET /api/v1/functions/{sid}

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Response

200: a Function object.

Example

bash
curl "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Update a function's settings ​

PATCH /api/v1/functions/{sid}

Change the function's settings in one environment; a running function is redeployed with them (the same image unless the runtime or entry file changed).

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Request body

FieldTypeRequiredDescription
runtime"node22", "python312"nocan be null
entrystringnomax length 200, can be null
memory_mbintegernocan be null
timeout_sintegernocan be null
concurrencyintegernocan be null
max_replicasintegernocan be null
idle_timeout_sintegernocan be null
auth"public", "token"nocan be null
namestringnomin length 1, max length 100, can be null

Response

200: a Function object.

Example

bash
curl -X PATCH "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"runtime":"node22"}'

Delete a function ​

DELETE /api/v1/functions/{sid}

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes

Response

204: no content.

Example

bash
curl -X DELETE "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Get a function's code ​

GET /api/v1/functions/{sid}/code

The function's latest saved inline code (shared by all environments).

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes

Response

200: a Function code object.

Example

bash
curl "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/code" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Save a function's code ​

PUT /api/v1/functions/{sid}/code

Save the function's inline code (all files; files left out are deleted) and optionally deploy it.

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Request body

FieldTypeRequiredDescription
filesarray of FileInyesmax 100 items
deploybooleannodefault false

Response

200: JSON.

Example

bash
curl -X PUT "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/code" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"files":[{"path":"string","content":"string"}]}'

Deploy a function ​

POST /api/v1/functions/{sid}/deploy

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Response

200: a Deployment object.

Example

bash
curl -X POST "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/deploy" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Get a function's token ​

GET /api/v1/functions/{sid}/token

The token callers send in the X-Fjordrun-Token header when the function's auth is "token".

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Response

200: JSON.

Example

bash
curl "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/token" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Rotate a function's token ​

POST /api/v1/functions/{sid}/token/rotate

Replace the token; the old one stops working once the function is redeployed (which this starts).

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Response

200: JSON.

Example

bash
curl -X POST "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/token/rotate" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Invoke a function ​

POST /api/v1/functions/{sid}/invoke

Call the deployed function through its public URL (the test console). Billed like any other request.

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null

Request body

FieldTypeRequiredDescription
method"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"nodefault "GET"
pathstringnomax length 2000, pattern ^/, default "/"
headersobject (values: string)no
bodystringnomax length 1048576, can be null

Response

200: a Function invocation object.

Example

bash
curl -X POST "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/invoke" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"method":"GET"}'

Get function invocation stats ​

GET /api/v1/functions/{sid}/stats

Invocations, errors, cold starts and p50/p95 duration over the range, with per-step series.

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null
rangequery"1h", "6h", "24h", "7d"nodefault "1h"

Response

200: a Function stats object.

Example

bash
curl "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/stats" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Get function logs ​

GET /api/v1/functions/{sid}/logs

The function's output: what the handler prints, plus one line per invocation.

Authentication: a team API token or personal access token.

Parameters

NameInTypeRequiredDescription
sidpathstring (UUID)yes
environment_idquerystring (UUID)nocan be null
searchquerystringnocan be null
levelquery"info", "warn", "error"nocan be null
limitqueryintegernomin 1, max 2000, default 200

Response

200: a list of Log line objects.

Example

bash
curl "https://api.fjordrun.com/api/v1/functions/$FUNCTION_ID/logs" \
  -H "Authorization: Bearer $FJORDRUN_TOKEN"

Request objects ​

CodeIn ​

FieldTypeRequiredDescription
filesarray of FileInyesmax 100 items
deploybooleannodefault false

FileIn ​

FieldTypeRequiredDescription
pathstringyesmin length 1, max length 200
contentstringyes

FunctionCreateIn ​

FieldTypeRequiredDescription
runtime"node22", "python312"nodefault "node22"
entrystringnomax length 200, can be null
memory_mbintegernocan be null
timeout_sintegernocan be null
concurrencyintegernocan be null
max_replicasintegernocan be null
idle_timeout_sintegernocan be null
auth"public", "token"nocan be null
environment_idstring (UUID)yes
namestringnomax length 100, can be null
filesarray of FileInnomax 100 items, can be null
sourceGitHubSourceInnocan be null
deploybooleannodefault true

FunctionPatchIn ​

FieldTypeRequiredDescription
runtime"node22", "python312"nocan be null
entrystringnomax length 200, can be null
memory_mbintegernocan be null
timeout_sintegernocan be null
concurrencyintegernocan be null
max_replicasintegernocan be null
idle_timeout_sintegernocan be null
auth"public", "token"nocan be null
namestringnomin length 1, max length 100, can be null

GitHubSourceIn ​

FieldTypeRequiredDescription
type"github"nodefault "github"
repostringyesmax length 200
branchstringnomax length 200, can be null
root_dirstringnomax length 200, can be null

InvokeIn ​

FieldTypeRequiredDescription
method"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"nodefault "GET"
pathstringnomax length 2000, pattern ^/, default "/"
headersobject (values: string)no
bodystringnomax length 1048576, can be null

Fjordrun is hosted in the EU (Hetzner, Nuremberg, Germany). Private beta.