Functions
Every /v1 route for functions. This page is generated from the API's OpenAPI contract, so it always matches what the API accepts and returns.
Authentication, pagination, errors and idempotency work the same on every route. They are described once, in the API overview.
Reserve an upload for a function's code (a .zip, up to 20 MB)
POST /v1/function-uploads
Key scopes: WRITE and PLATFORM_API.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
projectId | string (uuid) | yes | |
environmentId | string (uuid) | no | Defaults to the project's production environment. |
name | string | yes | e.g. hello |
sizeBytes | number | yes | Size of the zip in bytes. |
Returns
201withV1StaticUpload.
curl -X POST "https://api.naijacloud.com/v1/function-uploads" \
-H "Authorization: Bearer $NC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"projectId":"…","name":"hello","sizeBytes":1}'Deploy an uploaded zip as the next version of a function
POST /v1/functions
Creates the function on its first deploy. The previous version keeps serving until the new one is live, and stays if the deploy fails.
Key scopes: WRITE and PLATFORM_API.
Headers
| Name | Type | Required | Notes |
|---|---|---|---|
Idempotency-Key | string | no | Any unique string (1–255 printable characters). A retry with the same key and body returns the first response instead of acting twice, for 24 hours. |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
projectId | string (uuid) | yes | |
environmentId | string (uuid) | no | Defaults to the project's production environment. |
name | string | yes | e.g. hello |
uploadId | string (uuid) | yes | |
entrypoint | string | no | e.g. index.ts |
command | string | no | The command that deployed it, shown on the live version. |
tier | FREE, PRO, PRO_PLUS, STANDARD, STARTER | no | Only used when this deploy creates the environment's functions runtime. Without it the runtime is Free while the workspace has its free runtime open. |
Returns
201withV1DeployFunctionResult.
curl -X POST "https://api.naijacloud.com/v1/functions" \
-H "Authorization: Bearer $NC_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"projectId":"…","name":"hello","uploadId":"…"}'Get a function, with its live and newest versions
GET /v1/functions/{functionId}
Key scopes: READ and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
functionId | string | yes | The function's id. |
Returns
200withV1Function.
curl "https://api.naijacloud.com/v1/functions/$FUNCTION_ID" \
-H "Authorization: Bearer $NC_API_KEY"Delete a function
DELETE /v1/functions/{functionId}
Its URL stops answering and its logs go with it.
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
functionId | string | yes | The function's id. |
Returns
204with no body.
curl -X DELETE "https://api.naijacloud.com/v1/functions/$FUNCTION_ID" \
-H "Authorization: Bearer $NC_API_KEY"List a project environment's functions by name
GET /v1/projects/{projectId}/functions
Key scopes: READ and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
projectId | string | yes | The project's id. |
Query parameters
| Name | Type | Required | Notes |
|---|---|---|---|
limit | integer | no | Rows per page. Ignored when a cursor is given. |
cursor | string | no | The nextCursor of the previous page, unchanged. |
search | string | no | Only rows whose name contains this. Send the same value with every page of one walk. |
environmentId | string (uuid) | no | Defaults to the project's production environment. |
Returns
200with a page:{ data: V1Function[], nextCursor }, where each item isV1Function.
curl "https://api.naijacloud.com/v1/projects/$PROJECT_ID/functions" \
-H "Authorization: Bearer $NC_API_KEY"Types
V1Deploy
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
serviceId | string (uuid) | |
status | QUEUED, BUILDING, TESTING, DEPLOYING, RUNNING, FAILED, CANCELLED, REPLACED, SUPERSEDED | |
trigger | PUSH, MANUAL, ROLLBACK, FIRST_DEPLOY, SYSTEM, or null | What started it: a push, a person, a rollback, … |
branch | string, or null | |
commitSha | string, or null | |
commitMessage | string, or null | |
authorName | string, or null | |
buildCommand | string, or null | |
startCommand | string, or null | |
error | string, or null | Why it failed, written for you. |
errorCode | MISSING_SCRIPT, COMMAND_NOT_FOUND, MODULE_NOT_FOUND, BUILD_FAILED, CRASH, OOM, PORT_NOT_LISTENING, HEALTH_TIMEOUT, IMAGE_REJECTED, BUILD_OOM, NODE_BUSY, NODE_LOW_DISK, DATA_SERVICE_ON_OTHER_NODE, FREE_BUILD_LIMIT, UNKNOWN, or null | |
durationMs | number, or null | From the start of work (not queueing) to the end, in ms. |
createdAt | string (date-time) | |
startedAt | string (date-time), or null | |
finishedAt | string (date-time), or null |
V1DeployFunctionResult
| Field | Type | Notes |
|---|---|---|
function | V1Function | |
version | V1FunctionVersion | |
deploy | V1Deploy |
V1Function
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
name | string | e.g. send-receipt |
url | string | e.g. https://shop-fn.naijacloud.app/functions/v1/send-receipt |
status | DEPLOYING, LIVE, SLEEPING, FAILED, ERRORING, STOPPED | |
statusDetail | string, or null | |
region | string, or null | e.g. eu-west |
tier | FREE, PRO, PRO_PLUS, STANDARD, STARTER | |
runtimeServiceId | string (uuid), or null | The hidden web service every function in the environment runs in. |
environmentId | string (uuid) | |
liveVersion | V1FunctionVersion, or null | |
latestVersion | V1FunctionVersion, or null | |
calls24h | number, or null | |
errors24h | number, or null | |
limits | V1FunctionLimits | |
createdAt | string (date-time) | |
updatedAt | string (date-time) |
V1FunctionLimits
| Field | Type | Notes |
|---|---|---|
memoryMb | number | |
maxDurationSeconds | number | Longest one call may run before a 504. |
maxCodeBytes | number | Largest upload per deploy, in bytes. |
V1FunctionVersion
| Field | Type | Notes |
|---|---|---|
id | string (uuid) | |
number | number | From 1, per function. |
status | DEPLOYING, LIVE, REPLACED, FAILED | |
sizeBytes | number | |
entrypoint | string | e.g. index.ts |
command | string, or null | |
deployedByName | string, or null | |
deployId | string (uuid), or null | The runtime deploy carrying it; its logs are the build log. |
errorMessage | string, or null | |
createdAt | string (date-time) |
V1StaticUpload
| Field | Type | Notes |
|---|---|---|
uploadId | string (uuid) | |
url | string | A presigned URL; it expires. |
method | string | e.g. PUT |
headers | array of V1UploadHeader | |
maxBytes | number | |
expiresInSeconds | number |
V1UploadHeader
| Field | Type | Notes |
|---|---|---|
name | string | |
value | string |