# Integrate Functions into Your Operations Workflows The Sinch Functions API exposes read-only endpoints for monitoring your deployed functions. Use these to connect functions to your existing operations tooling — PagerDuty, Grafana, custom dashboards, or CI/CD health checks. **Base URL:** `https://functions.api.sinch.com` **Authentication:** OAuth 2.0 (the same authentication used by the Sinch dashboard). All requests must include a valid OAuth bearer token scoped to your project. ## Available endpoints All endpoints are scoped to a project and function: ``` /v1/projects/{projectId}/functions/{functionId}/... ``` Your `projectId` is visible in the Sinch dashboard and in `sinch.json`. The `functionId` is returned when you deploy via the CLI (`sinch functions list` shows all IDs). ## Function status Check whether a function is running, stopped, or in a deployment cycle. ``` GET /v1/projects/{projectId}/functions/{functionId}/status ``` **Response:** ```json { "functionId": "01JKXF00000000000003", "status": "Running", "error": null, "url": "https://fn-01jkxf00000000000003.functions.sinch.com" } ``` **Status values:** `Running`, `Stopped`, `Failed`, `Building`, `Deploying`, `PreparingBuild`, `Queued`, `Created` Use this for health checks and alerting. Poll on an interval or call it from your CI pipeline after a deploy to confirm the function came up healthy. ## Real-time log streaming (SSE) Open a Server-Sent Events connection to tail logs in real time. Each event contains a full request/response cycle including console output from your function. ``` GET /v1/projects/{projectId}/functions/{functionId}/logs/stream ``` **Query parameters:** | Parameter | Type | Description | | --- | --- | --- | | `since` | ISO 8601 | Only stream events after this timestamp | | `level` | `debug` | `info` | `warning` | `error` | Filter by minimum log level | **Example with curl:** ```bash curl -N -H "Authorization: Bearer $TOKEN" \ "https://functions.api.sinch.com/v1/projects/$PROJECT_ID/functions/$FUNCTION_ID/logs/stream" ``` Each SSE event is a JSON object containing the HTTP request, response, execution time, memory usage, and any console log output from your function code. Connect this to your log aggregator or alerting system to react to errors in real time. ## Historical logs Query past requests with filtering, search, and pagination. ``` GET /v1/projects/{projectId}/functions/{functionId}/logs ``` **Query parameters:** | Parameter | Type | Description | | --- | --- | --- | | `startTime` | ISO 8601 | Start of time range | | `endTime` | ISO 8601 | End of time range | | `level` | `debug` | `info` | `warning` | `error` | Filter to requests with logs at this level or above | | `search` | string | Search request URL, body, or log messages | | `status` | `success` | `redirect` | `error` | Filter by HTTP status category (2xx, 3xx, 4xx+) | | `page` | integer | Page number (default: 1) | | `pageSize` | integer | Results per page (default: 100) | | `order` | `asc` | `desc` | Sort order (default: `desc`) | **Response:** ```json { "requests": [ { "id": "...", "httpMethod": "POST", "url": "https://fn-...", "statusCode": 200, "executionTimeMs": 42, "memoryUsedMB": 64, "startTime": "2026-02-19T14:30:00Z", "endTime": "2026-02-19T14:30:00.042Z", "logs": [{ "level": "Info", "message": "ICE: call from +15551234567", "timestamp": "..." }] } ], "pagination": { "page": 1, "pageSize": 100, "totalCount": 500, "totalPages": 5 } } ``` Use this to build custom dashboards, run nightly error reports, or feed logs into your SIEM. ## Metrics Get aggregated performance metrics for a function over a time range. ``` GET /v1/projects/{projectId}/functions/{functionId}/metrics?timeRange=24h ``` **`timeRange` values:** `1h`, `4h`, `24h` (default), `7d`, `30d` **Response:** ```json { "functionName": "ivr-handler", "timeRange": "24h", "summary": { "totalRequests": 1000, "avgResponseTime": 120.5, "errorRate": 2.3, "avgMemory": 64.2, "avgCpuUsage": 45.1 }, "responseTimeSeries": [ { "timestamp": "...", "averageResponseTime": 110, "p95ResponseTime": 250 } ], "requestVolumeSeries": [{ "timestamp": "...", "totalRequests": 85 }], "errorRateSeries": [{ "timestamp": "...", "errorRate": 1.5 }] } ``` Use this to build Grafana dashboards, set up threshold-based alerting, or track performance trends over time. ## Billing Get current billing period cost summary. ``` GET /v1/projects/{projectId}/billing/current ``` Per-function cost breakdown: ``` GET /v1/projects/{projectId}/functions/{functionId}/costs?period=month ``` ## List functions Get all functions in a project with their current status. ``` GET /v1/projects/{projectId}/functions ``` **Response:** ```json { "functions": [ { "id": "01JKXF00000000000003", "name": "ivr-handler", "runtime": "node", "status": "Running", "createdAt": "2026-01-15T10:00:00Z", "updatedAt": "2026-02-18T14:30:00Z" } ], "total": 3 } ``` ## Rate limits These endpoints share the project-level rate limits documented in [Limits and Constraints](/docs/functions/reference/limits). Key limits for operations use: | Endpoint | Limit | | --- | --- | | Function status, list, metrics | 100 requests / 60s | | Historical logs | 200 requests / 60s | | Log streaming (SSE) | 5 concurrent connections | ## Coming soon: OpenTelemetry export We are adding native OpenTelemetry (OTel) support to Sinch Functions. When available, your functions will be able to export traces, metrics, and logs directly to your own observability backend — Datadog, Grafana Cloud, New Relic, or any OTel-compatible collector. This will be available as a paid add-on. The endpoints documented on this page remain free and available to all projects.