> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iblueprint.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve blueprint execution logs and run history

> Retrieve paginated execution log records for a specific iBlueprint blueprint, including step-level token usage, AI provider details, MCP server activity, and error summaries.

The `execution.getExecutionLogs` procedure returns the history of past execution runs for a single blueprint, most recent first. Each log record includes rich metadata about how nodes ran: tokens consumed, which AI providers were used, whether external data sources or MCP servers were contacted, and a summary of any errors. Use this data for auditing, debugging, and billing analysis.

## Request

**Procedure type:** query (HTTP `GET`)

**Endpoint:**

```
GET https://api.iblueprint.ai/api/trpc/execution.getExecutionLogs
```

### Parameters

<ParamField query="input" type="object" required>
  A URL-encoded JSON object with a `json` key containing the parameters below.
</ParamField>

<ParamField query="json.blueprintId" type="string" required>
  UUID of the blueprint whose logs you want to retrieve.
</ParamField>

<ParamField query="json.limit" type="number">
  Maximum number of log records to return. Defaults to `20`.
</ParamField>

<ParamField query="json.offset" type="number">
  Number of records to skip before returning results, for pagination. Defaults to `0`.
</ParamField>

## Response

<ResponseField name="logs" type="array">
  Array of execution log records, ordered by `createdAt` descending.

  <Expandable title="Log record fields">
    <ResponseField name="id" type="string">Unique execution log ID.</ResponseField>
    <ResponseField name="blueprintId" type="string">Blueprint this execution belongs to.</ResponseField>
    <ResponseField name="organizationId" type="string">Organization the execution ran under.</ResponseField>
    <ResponseField name="userId" type="string">User who triggered the execution.</ResponseField>
    <ResponseField name="status" type="string">Final status: `running`, `completed`, or `failed`.</ResponseField>
    <ResponseField name="startTime" type="string">ISO 8601 start timestamp, or `null`.</ResponseField>
    <ResponseField name="endTime" type="string">ISO 8601 end timestamp, or `null`.</ResponseField>
    <ResponseField name="totalSteps" type="number">Total nodes in the run.</ResponseField>
    <ResponseField name="completedSteps" type="number">Nodes that completed successfully.</ResponseField>
    <ResponseField name="failedSteps" type="number">Nodes that failed.</ResponseField>
    <ResponseField name="progress" type="number">Final progress percentage (0–100).</ResponseField>
    <ResponseField name="executionData" type="object">Raw step and log data from the runner.</ResponseField>
    <ResponseField name="createdAt" type="string">ISO 8601 timestamp when the log record was created.</ResponseField>
    <ResponseField name="updatedAt" type="string">ISO 8601 timestamp of the last update.</ResponseField>
    <ResponseField name="totalTokensUsed" type="number">Total LLM tokens consumed across all nodes.</ResponseField>
    <ResponseField name="usedMcpServers" type="boolean">`true` if any MCP server was contacted during the run.</ResponseField>
    <ResponseField name="mcpServerCount" type="number">Number of distinct MCP servers used.</ResponseField>
    <ResponseField name="mcpServerNames" type="array">Names of the MCP servers contacted.</ResponseField>
    <ResponseField name="reachedOutForData" type="boolean">`true` if any node fetched data from an external source.</ResponseField>
    <ResponseField name="externalDataSourcesCount" type="number">Number of external data sources accessed.</ResponseField>
    <ResponseField name="dataSourcesSummary" type="array">Summary of each external data source accessed.</ResponseField>
    <ResponseField name="requiredLogin" type="boolean">`true` if the run required OAuth authentication.</ResponseField>
    <ResponseField name="oauthFlowsTriggered" type="boolean">`true` if an OAuth flow was initiated.</ResponseField>
    <ResponseField name="authenticationMethodsUsed" type="array">List of authentication methods used (e.g. `oauth2`, `api_key`).</ResponseField>
    <ResponseField name="primaryAiProviderConnectionId" type="string">Connection ID of the primary AI provider used.</ResponseField>
    <ResponseField name="aiProvidersUsedCount" type="number">Number of distinct AI providers involved.</ResponseField>
    <ResponseField name="hasErrors" type="boolean">`true` if any errors occurred.</ResponseField>
    <ResponseField name="errorCount" type="number">Total error count.</ResponseField>
    <ResponseField name="criticalErrors" type="boolean">`true` if any critical (run-stopping) errors occurred.</ResponseField>
    <ResponseField name="errorSummary" type="string">Human-readable summary of errors, if any.</ResponseField>
    <ResponseField name="inputVariables" type="object">Variables passed to the execution at start time.</ResponseField>
    <ResponseField name="outputSummary" type="object">High-level summary of the execution output.</ResponseField>
    <ResponseField name="executionMetadata" type="object">Additional metadata set by the runner.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="number">Number of records returned in this response (not the total across all pages).</ResponseField>

## Example

<CodeGroup>
  ```bash curl theme={null}
  curl -G "https://api.iblueprint.ai/api/trpc/execution.getExecutionLogs" \
    --data-urlencode 'input={"json":{"blueprintId":"3fa85f64-5717-4562-b3fc-2c963f66afa6","limit":10,"offset":0}}' \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    input: JSON.stringify({
      json: {
        blueprintId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
        limit: 10,
        offset: 0,
      },
    }),
  });

  const response = await fetch(
    `https://api.iblueprint.ai/api/trpc/execution.getExecutionLogs?${params}`,
    { headers: { Authorization: 'Bearer YOUR_API_KEY' } }
  );

  const { result } = await response.json();
  const { logs, total } = result.data.json;
  console.log(`Retrieved ${total} execution logs`);
  ```
</CodeGroup>

### Sample response

```json theme={null}
{
  "result": {
    "data": {
      "json": {
        "logs": [
          {
            "id": "log-uuid-1",
            "blueprintId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "status": "completed",
            "startTime": "2024-12-01T10:00:00Z",
            "endTime": "2024-12-01T10:00:12Z",
            "totalSteps": 4,
            "completedSteps": 4,
            "failedSteps": 0,
            "progress": 100,
            "totalTokensUsed": 1842,
            "usedMcpServers": false,
            "aiProvidersUsedCount": 1,
            "hasErrors": false,
            "inputVariables": { "email_body": "Hi team..." },
            "outputSummary": { "summary": "..." }
          }
        ],
        "total": 1
      }
    }
  }
}
```

## Cross-blueprint logs

To fetch logs across all blueprints for your account (or organization), use `execution.listRecentExecutions` instead. It accepts `limit`, `offset`, and an optional `organizationId` filter, and returns the same log record shape.

```bash theme={null}
curl -G "https://api.iblueprint.ai/api/trpc/execution.listRecentExecutions" \
  --data-urlencode 'input={"json":{"limit":50,"offset":0}}' \
  -H "Authorization: Bearer YOUR_API_KEY"
```
