Skip to content

Functions endpoints

27 endpoints at https://api.vaif.studio, generated from the API's OpenAPI document. The REST API page covers authentication, and All endpoints lists every group.

POST /functions/

Request body (application/json, required)
{
  projectId: string (uuid);
  envId?: string (uuid);
  name: string;
  description?: string;
  entrypoint?: string;
  runtime?: string;
  timeoutMs?: number;
  schedule?: string;
}
Response 200 (application/json)
{
  avgDurationMs: number;
  createdAt: string (date-time);
  deployError: null | string;
  deployStatus: string;
  deployedAt: null | string (date-time);
  description: null | string;
  enabled: boolean;
  entrypoint: string;
  envId: null | string;
  id: string;
  invocationCount: number;
  lastInvokedAt: null | string (date-time);
  lastRunAt: null | string (date-time);
  memoryMb: number;
  name: string;
  projectId: string;
  runtime: string;
  schedule: null | string;
  sourceCode: null | string;
  timeoutMs: number;
  updatedAt: string (date-time);
}

Errors: 400, 401, 403, 404, 409, with the error body.

GET /functions/project/{projectId}

ParameterInTypeRequired
projectIdpathstringYes
envIdquerystringNo
enabledquerystringNo
Response 200 (application/json)
{
  id: string;
  projectId: string;
  envId: null | string;
  name: string;
  description: null | string;
  entrypoint: string;
  runtime: string;
  sourceCode: null | string;
  enabled: boolean;
  timeoutMs: number;
  memoryMb: number;
  schedule: null | string;
  lastRunAt: null | string (date-time);
  lastInvokedAt: null | string (date-time);
  invocationCount: number;
  avgDurationMs: number;
  deployStatus: string;
  deployedAt: null | string (date-time);
  deployError: null | string;
  createdAt: string (date-time);
  updatedAt: string (date-time);
}[]

GET /functions/{functionId}

ParameterInTypeRequired
functionIdpathstringYes
Response 200 (application/json)
{
  deployedBy: null | {
    id: string;
    name: null | string;
  };
  envRead: string[];
  id: string;
  projectId: string;
  envId: null | string;
  name: string;
  description: null | string;
  entrypoint: string;
  runtime: string;
  sourceCode: null | string;
  enabled: boolean;
  timeoutMs: number;
  memoryMb: number;
  schedule: null | string;
  lastRunAt: null | string (date-time);
  lastInvokedAt: null | string (date-time);
  invocationCount: number;
  avgDurationMs: number;
  deployStatus: string;
  deployedAt: null | string (date-time);
  deployError: null | string;
  createdAt: string (date-time);
  updatedAt: string (date-time);
}

PATCH /functions/{functionId}

ParameterInTypeRequired
functionIdpathstringYes
Request body (application/json, required)
{
  name?: string;
  description?: string | null;
  enabled?: boolean;
  timeoutMs?: number;
  schedule?: string | null;
  entrypoint?: string;
}
Response 200 (application/json)
{
  id: string;
  projectId: string;
  envId: null | string;
  name: string;
  description: null | string;
  entrypoint: string;
  runtime: string;
  sourceCode: null | string;
  enabled: boolean;
  timeoutMs: number;
  memoryMb: number;
  schedule: null | string;
  lastRunAt: null | string (date-time);
  lastInvokedAt: null | string (date-time);
  invocationCount: number;
  avgDurationMs: number;
  deployStatus: string;
  deployedAt: null | string (date-time);
  deployError: null | string;
  createdAt: string (date-time);
  updatedAt: string (date-time);
}

Errors: 400, 401, 403, 404, with the error body.

DELETE /functions/{functionId}

ParameterInTypeRequired
functionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
}

GET /functions/project/{projectId}/name/{functionName}

ParameterInTypeRequired
projectIdpathstringYes
functionNamepathstringYes
envIdquerystringNo
Response 200 (application/json)
{
  id: string;
  projectId: string;
  envId: null | string;
  name: string;
  description: null | string;
  entrypoint: string;
  runtime: string;
  sourceCode: null | string;
  enabled: boolean;
  timeoutMs: number;
  memoryMb: number;
  schedule: null | string;
  lastRunAt: null | string (date-time);
  lastInvokedAt: null | string (date-time);
  invocationCount: number;
  avgDurationMs: number;
  deployStatus: string;
  deployedAt: null | string (date-time);
  deployError: null | string;
  createdAt: string (date-time);
  updatedAt: string (date-time);
}

POST /functions/{functionIdOrName}/invoke

ParameterInTypeRequired
functionIdOrNamepathstringYes
Request body (application/json)
{
  body?: null | boolean | number | string | JsonValue[] | {
    [key: string]: JsonValue;
  };
  headers?: {
    [key: string]: string;
  };
  method?: string;
  path?: string;
  query?: {
    [key: string]: string;
  };
}
Response 200 (application/json)
null | boolean | number | string | JsonValue[] | {
  [key: string]: JsonValue;
}

GET /functions/invocations/function/{functionId}

ParameterInTypeRequired
functionIdpathstringYes
limitquerystringNo
Response 200 (application/json)
{
  id: string;
  functionId: string;
  projectId: string;
  envId: null | string;
  status: string;
  durationMs: number;
  statusCode: null | number;
  errorMessage: null | string;
  createdAt: string (date-time);
}[]

GET /functions/invocations

ParameterInTypeRequired
functionIdquerystringNo
projectIdquerystringNo
envIdquerystringNo
statusquerystringNo
sincequerystringNo
untilquerystringNo
limitquerystringNo
offsetquerystringNo
Response 200 (application/json)
{
  invocations: {
    id: string;
    functionId: string;
    projectId: string;
    envId: null | string;
    status: string;
    durationMs: number;
    statusCode: null | number;
    errorMessage: null | string;
    createdAt: string (date-time);
  }[];
  total: number;
}

GET /functions/{functionId}/invocations

ParameterInTypeRequired
functionIdpathstringYes
limitquerystringNo
offsetquerystringNo
Response 200 (application/json)
{
  id: string;
  functionId: string;
  projectId: string;
  envId: null | string;
  status: string;
  durationMs: number;
  statusCode: null | number;
  errorMessage: null | string;
  createdAt: string (date-time);
}[]

PUT /functions/{functionId}/source

ParameterInTypeRequired
functionIdpathstringYes
Request body (application/json, required)
{
  sourceCode: string;
}
Response 200 (application/json)
{
  ok: true;
}

Errors: 400, 401, 403, 404, 422, 503, with the error body.

GET /functions/{functionId}/deploy-status

ParameterInTypeRequired
functionIdpathstringYes
Response 200 (application/json)
{
  functionId: string;
  functionName: string;
  status: string;
  deployedAt: null | string (date-time);
  lastError: null | string;
  lastUpdated: string (date-time);
}

GET /functions/{functionId}/logs

ParameterInTypeRequired
functionIdpathstringYes
limitquerystringNo
statusquerystringNo
sincequerystringNo
untilquerystringNo
executionIdquerystringNo
levelquerystringNo
qquerystringNo
beforequerystringNo
Response 200 (application/json)
{
  invocations: {
    id: string;
    timestamp: string (date-time);
    level: string;
    status: string;
    durationMs: number;
    statusCode: null | number;
    message: string;
  }[];
  logs: {
    id: string;
    executionId: string;
    timestamp: string (date-time);
    level: string;
    message: string;
    source: string;
    metadata: any;
    sequence: number;
  }[];
  total: number;
  hasMore: boolean;
  nextCursor: null | string;
}

GET /functions/project/{projectId}/summary

ParameterInTypeRequired
projectIdpathstringYes
envIdquerystringNo
periodquerystringNo
Response 200 (application/json)
{
  envId: string;
  period: "24h" | "30d" | "7d";
  since: string;
  totals: {
    functionCount: number;
    invocations: number;
    successes: number;
    errors: number;
    timeouts: number;
    skipped: number;
    errorRate: null | number;
    avgMs: null | number;
    p95Ms: null | number;
    slowest: null | {
      functionId: string;
      name: string;
      p95Ms: null | number;
    };
  };
  functions: {
    functionId: string;
    name: string;
    invocations: number;
    successes: number;
    errors: number;
    timeouts: number;
    skipped: number;
    errorRate: null | number;
    avgMs: null | number;
    p95Ms: null | number;
    maxMs: null | number;
    lastRun: null | {
      at: string;
      status: string;
      statusCode: any;
      message: any;
    };
    lastSkipReason: null | string;
    triggers: {
      event: string;
      tableName: string;
      enabled: boolean;
    }[];
  }[];
}

GET /functions/{functionId}/metrics

ParameterInTypeRequired
functionIdpathstringYes
periodquerystringNo
Response 200 (application/json)
{
  functionId: string;
  functionName: string;
  period: "24h" | "30d" | "7d";
  summary: {
    totalInvocations: number;
    successCount: number;
    errorCount: number;
    timeoutCount: number;
    successRate: number;
    skippedCount: number;
  };
  latency: {
    avgMs: number;
    minMs: number;
    maxMs: number;
    p95Ms: number;
  };
  deployment: {
    status: string;
    deployedAt: null | string (date-time);
    lastError: null | string;
  };
  timeSeries: {
    timestamp: string;
    success: number;
    error: number;
    timeout: number;
  }[];
}

POST /functions/secrets

Request body (application/json, required)
{
  projectId: string (uuid);
  envId?: string | null;
  key: string;
  value: string;
  allowProduction?: boolean;
}
Response 200 (application/json)
{
  id: string;
  projectId: string;
  envId: null | string;
  key: string;
  createdAt: string (date-time);
}

Errors: 400, 401, 403, 404, 409, 500, with the error body.

GET /functions/secrets/project/{projectId}

ParameterInTypeRequired
projectIdpathstringYes
envIdquerystringNo
Response 200 (application/json)
{
  id: string;
  key: string;
  envId: null | string;
  createdAt: string (date-time);
}[]

PUT /functions/secrets/{secretId}

ParameterInTypeRequired
secretIdpathstringYes
Request body (application/json, required)
{
  value: string;
  allowProduction?: boolean;
}
Response 200 (application/json)
{
  id: string;
  projectId: string;
  envId: null | string;
  key: string;
  createdAt: string (date-time);
}

Errors: 400, 401, 403, 404, 500, with the error body.

DELETE /functions/secrets/{secretId}

ParameterInTypeRequired
secretIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
}

GET /functions/{functionId}/triggers

ParameterInTypeRequired
functionIdpathstringYes
Response 200 (application/json)
{
  id: string;
  functionId: string;
  projectId: string;
  event: string;
  tableName: string;
  enabled: boolean;
  filter: any;
  createdAt: string (date-time);
  updatedAt: string (date-time);
}[]

POST /functions/{functionId}/triggers

ParameterInTypeRequired
functionIdpathstringYes
Request body (application/json, required)
{
  event: "db.insert" | "db.update" | "db.delete";
  tableName: string;
  enabled?: boolean;
  filter?: { [key: string]: any };
}
Response 200 (application/json)
{
  createdAt: string (date-time);
  enabled: boolean;
  event: string;
  filter: any;
  functionId: string;
  id: string;
  projectId: string;
  tableName: string;
  updatedAt: string (date-time);
}

Errors: 400, 401, 403, 404, with the error body.

PATCH /functions/triggers/{triggerId}

ParameterInTypeRequired
triggerIdpathstringYes
Request body (application/json, required)
{
  enabled: boolean;
}
Response 200 (application/json)
{
  id: string;
  functionId: string;
  projectId: string;
  event: string;
  tableName: string;
  enabled: boolean;
  filter: any;
  createdAt: string (date-time);
  updatedAt: string (date-time);
}

Errors: 400, 401, 403, 404, with the error body.

DELETE /functions/triggers/{triggerId}

ParameterInTypeRequired
triggerIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
}

GET /functions/schedule/preview

ParameterInTypeRequired
cronquerystringNo
Response 200 (application/json)
{
  valid: boolean;
  cron: string;
  nextRuns: string[];
  timezone: string;
} | {
  valid: boolean;
  cron: string;
  error: string;
  nextRuns: any[];
  timezone: string;
}

GET /functions/{functionId}/schedule

ParameterInTypeRequired
functionIdpathstringYes
Response 200 (application/json)
{
  functionId: string;
  cron: null | string;
  enabled: boolean;
  lastRunAt: null | string (date-time);
}

PUT /functions/{functionId}/schedule

ParameterInTypeRequired
functionIdpathstringYes
Request body (application/json, required)
{
  cron: string;
  enabled?: boolean;
}
Response 200 (application/json)
{
  functionId: string;
  cron: null | string;
  enabled: boolean;
}

Errors: 400, 401, 403, 404, with the error body.

DELETE /functions/{functionId}/schedule

ParameterInTypeRequired
functionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
}