Skip to content

Logs API

API endpoints for accessing request logs and execution traces.

User Logs

Get your recent request history.

http
GET /logs/user

Query Parameters:

ParameterTypeDescription
limitnumberMax records (default: 10)
statusCodenumberFilter by status code
actionIdstringFilter by action

Example:

bash
curl "https://api.universalapi.co/logs/user?limit=5" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "success": true,
  "data": {
    "logs": [
      {
        "requestId": "abc-123",
        "userId": "user-id",
        "actionId": "act-458dfb350d314769",
        "timestamp": 1736734800000,
        "timestampISO": "2025-01-13T12:00:00.000000",
        "path": "/action/act-458dfb350d314769",
        "statusCode": 200,
        "status": "COMPLETED",
        "xRayTraceId": "1-xxx-yyy",
        "traceUrl": "https://api.universalapi.co/logs/trace/1-xxx-yyy",
        "metrics": {
          "executionTime": 245,
          "memoryMb": 128,
          "creditsUsed": 1
        },
        "output": {
          "statusCode": 200,
          "body": {"message": "Hello!"}
        }
      }
    ],
    "total": 5
  }
}

Action-Specific Logs

Get logs for a specific action.

http
GET /logs/user/action/{actionId}

Example:

bash
curl "https://api.universalapi.co/logs/user/action/act-458dfb350d314769" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Request Log

Get details for a specific request.

http
GET /logs/request/{requestId}

Example:

bash
curl "https://api.universalapi.co/logs/request/abc-123" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "success": true,
  "data": {
    "requestId": "abc-123",
    "traceId": "1-xxx-yyy",
    "hasCloudWatchLogs": true,
    "logs": [
      {
        "timestamp": 1736734800000,
        "message": "START RequestId: abc-123",
        "logGroup": "/aws/lambda/universalapi-stack-...",
        "level": "unknown"
      },
      {
        "timestamp": 1736734800100,
        "message": "[INFO] Action executed successfully in 245ms",
        "level": "info"
      }
    ]
  }
}

Trace Log

Get comprehensive trace information including timeline and all related requests.

http
GET /logs/trace/{traceId}

Example:

bash
curl "https://api.universalapi.co/logs/trace/1-xxx-yyy" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "success": true,
  "data": {
    "traceId": "1-xxx-yyy",
    "hasXRayData": true,
    "trace": {
      "id": "1-xxx-yyy",
      "status": "complete",
      "requestCount": 2,
      "duration": 2831,
      "timeline": {
        "nodes": [
          {
            "id": "abc-123",
            "userId": "user-id",
            "actionId": "act-xxx",
            "path": "/action/act-xxx",
            "timestamp": 1736734800000,
            "status": "COMPLETED",
            "statusCode": 200,
            "executionTime": 245,
            "parentId": "ROOT",
            "children": []
          }
        ],
        "count": 1
      },
      "logs": [
        {
          "timestamp": 1736734800000,
          "message": "[INFO] Function execution started",
          "level": "info"
        }
      ],
      "keyEvents": [
        {
          "type": "report",
          "timestamp": 1736734802831,
          "function": "universalapi-stack-ActionHandler",
          "duration": 2786.53,
          "billedDuration": 2787,
          "memorySize": 128,
          "memoryUsed": 79
        }
      ]
    },
    "dbRequests": [
      {
        "requestId": "abc-123",
        "actionId": "act-xxx",
        "status": "COMPLETED",
        "output": {"statusCode": 200, "body": {"message": "Hello!"}}
      }
    ]
  },
  "debug": {
    "xrayConsoleUrl": "https://us-east-1.console.aws.amazon.com/xray/home?..."
  }
}

Workflow Logs

Get all requests in a workflow (requests sharing the same root).

http
GET /logs/workflow

Query Parameters:

ParameterTypeDescription
rootRequestIdstringRoot request ID

Example:

bash
curl "https://api.universalapi.co/logs/workflow?rootRequestId=root-123" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Log Levels

LevelDescription
infoInformational messages
warnWarnings
errorErrors
unknownSystem messages (START, END, REPORT)

Request Status Values

StatusDescription
PROCESSINGRequest is being processed
COMPLETEDRequest completed successfully
FAILEDRequest failed with error

Debugging Tips

  1. Use trace URLs - Every response includes debug.traceUrl
  2. Check execution time - Found in meta.executionTime
  3. Review logs - The trace endpoint shows CloudWatch logs
  4. Check memory - memoryUsed vs memorySize helps identify issues
  5. Follow the timeline - Multi-step requests show parent/child relationships

Universal API - The agentic entry point to the universe of APIs