functions
Get function execution logs
Get execution logs with pagination. Includes stats (totalExecutions, successful, failed, successRate, avgExecutionTime, lastRun).
GET
/api/functions/projects/{projectId}/functions/{functionId}/logsAuthentication
Requires JWT
Note
Include your JWT in the
Authorization: Bearer YOUR_TOKEN header (user-facing apps, RBAC). View authentication guide →Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Project ID (MongoDB ObjectId) that owns the function. |
functionId | string | Yes | Function ID (MongoDB ObjectId) to get logs for. |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Maximum number of log entries to return. |
offset | integer | No | Number of log entries to skip for pagination. |
SDK setup
Create a client and set credentials (JWT and/or API key) before calling the API. Match the authentication type shown above.
import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();
client.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig");import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();
client.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig");Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const result = await client.functions.getLogs({
projectId: "proj_AsIu33tafZGe",
functionId: "MVPQVsgjuHBlvWFB"
});const result = await client.functions.getLogs({
projectId: "proj_AsIu33tafZGe",
functionId: "MVPQVsgjuHBlvWFB"
});Try It Live
Test this endpoint with your own credentials. Your requests will be sent to the live API.
Use the auth endpoints to obtain a JWT.
No Request Yet
Send a request to see the full inspector
Responses
200Function logs and stats
json
{
"success": true,
"data": {
"executions": [
{
"executedAt": "2024-01-15T10:30:00.000Z",
"executionTime": 125,
"success": true,
"result": {
"processed": 1
},
"triggerType": "document",
"triggerEvent": "create",
"invokedBy": "trigger"
},
{
"executedAt": "2024-01-15T10:29:00.000Z",
"executionTime": 0,
"success": false,
"error": "Timeout",
"invokedBy": "manual"
}
],
"stats": {
"totalExecutions": 42,
"successful": 40,
"failed": 2,
"successRate": 95.24,
"avgExecutionTime": 125,
"lastRun": "2024-01-15T10:30:00.000Z"
}
}
}{
"success": true,
"data": {
"executions": [
{
"executedAt": "2024-01-15T10:30:00.000Z",
"executionTime": 125,
"success": true,
"result": {
"processed": 1
},
"triggerType": "document",
"triggerEvent": "create",
"invokedBy": "trigger"
},
{
"executedAt": "2024-01-15T10:29:00.000Z",
"executionTime": 0,
"success": false,
"error": "Timeout",
"invokedBy": "manual"
}
],
"stats": {
"totalExecutions": 42,
"successful": 40,
"failed": 2,
"successRate": 95.24,
"avgExecutionTime": 125,
"lastRun": "2024-01-15T10:30:00.000Z"
}
}
}401Authentication required or invalid token.
403Access denied or insufficient permissions.
Errors
| Code | Meaning |
|---|---|
401 | Authentication required or invalid token. |
403 | Access denied or insufficient permissions. |