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

# Get Execution Logs

Retrieve the execution history and logs for a specific cron job. This endpoint provides detailed information about past executions, including success/failure status, response codes, and error messages.

## Path Parameters

**accountId** `string` *required*

Your A1Base account ID

**cron\_job\_id** `string` *required*

The unique identifier of the cron job (UUID format)

## Query Parameters

**page** `integer` (default: 1)

Page number for pagination (minimum: 1)

**limit** `integer` (default: 50)

Number of items per page (minimum: 1, maximum: 100)

**status** `string`

Filter by execution status: `success`, `failure`, `error`, `timeout`

**start\_date** `string`

Filter logs after this date (ISO 8601 format)

Example: `2024-01-01T00:00:00Z`

**end\_date** `string`

Filter logs before this date (ISO 8601 format)

Example: `2024-01-31T23:59:59Z`

## Response

**data** `array`

Array of execution log objects

**Execution Log Object**

**id** `string`

Unique identifier for the execution

**cron\_job\_id** `string`

ID of the cron job that was executed

**executed\_at** `string`

ISO 8601 timestamp of when the job was executed

**status** `string`

Execution status: `success`, `failure`, `error`, `timeout`

**response\_code** `integer`

HTTP response code from the endpoint (null for timeouts)

**response\_body** `string`

Response body from the endpoint (truncated to 1KB)

**error\_message** `string`

Error message if the execution failed

**pagination** `object`

Pagination information

**Pagination Object**

**page** `integer`

Current page number

**limit** `integer`

Items per page

**total\_items** `integer`

Total number of log entries

**total\_pages** `integer`

Total number of pages

```bash cURL theme={null}
curl -X GET "https://api.a1base.com/v1/cron-jobs/{accountId}/logs/550e8400-e29b-41d4-a716-446655440000?page=1&limit=20&status=failure" \
  -H "X-API-Key: your-api-key" \
  -H "X-API-Secret: your-api-secret"
```

```javascript Node.js theme={null}
const axios = require('axios');

const getCronJobLogs = async (cronJobId) => {
  try {
    const response = await axios.get(
      `https://api.a1base.com/v1/cron-jobs/{accountId}/logs/${cronJobId}`,
      {
        params: {
          page: 1,
          limit: 20,
          status: 'failure',
          start_date: '2024-01-01T00:00:00Z'
        },
        headers: {
          'X-API-Key': 'your-api-key',
          'X-API-Secret': 'your-api-secret'
        }
      }
    );
    
    console.log('Execution logs:', response.data);
  } catch (error) {
    console.error('Error:', error.response.data);
  }
};

getCronJobLogs('550e8400-e29b-41d4-a716-446655440000');
```

```python Python theme={null}
import requests
from datetime import datetime, timedelta

def get_cron_job_logs(cron_job_id):
    url = f"https://api.a1base.com/v1/cron-jobs/{{accountId}}/logs/{cron_job_id}"
    
    headers = {
        "X-API-Key": "your-api-key",
        "X-API-Secret": "your-api-secret"
    }
    
    # Get logs from the last 7 days
    start_date = (datetime.now() - timedelta(days=7)).isoformat() + "Z"
    
    params = {
        "page": 1,
        "limit": 20,
        "status": "failure",
        "start_date": start_date
    }
    
    response = requests.get(url, headers=headers, params=params)
    
    if response.status_code == 200:
        data = response.json()
        print(f"Found {data['pagination']['total_items']} log entries")
        for log in data['data']:
            print(f"{log['executed_at']}: {log['status']} - {log['response_code']}")
    else:
        print("Error:", response.status_code, response.json())

get_cron_job_logs("550e8400-e29b-41d4-a716-446655440000")
```

```json theme={null}
{
  "data": [
    {
      "id": "exe_123456789",
      "cron_job_id": "550e8400-e29b-41d4-a716-446655440000",
      "executed_at": "2024-01-25T14:00:00Z",
      "status": "success",
      "response_code": 200,
      "response_body": "{\"message\": \"Report generated successfully\"}",
      "error_message": null
    },
    {
      "id": "exe_987654321",
      "cron_job_id": "550e8400-e29b-41d4-a716-446655440000",
      "executed_at": "2024-01-24T14:00:05Z",
      "status": "failure",
      "response_code": 500,
      "response_body": "{\"error\": \"Database connection failed\"}",
      "error_message": "Endpoint returned status code 500"
    },
    {
      "id": "exe_456789123",
      "cron_job_id": "550e8400-e29b-41d4-a716-446655440000",
      "executed_at": "2024-01-23T14:00:00Z",
      "status": "timeout",
      "response_code": null,
      "response_body": null,
      "error_message": "Request timed out after 30 seconds"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total_items": 3,
    "total_pages": 1
  }
}
```

## Log Analysis Examples

> [accordion] Find Recent Failures
>
> ```bash theme={null}
> GET /v1/cron-jobs/{accountId}/logs/{cron_job_id}?status=failure&limit=10
> ```
>
> Shows the 10 most recent failed executions.

> [accordion] Daily Success Rate
>
> ```bash theme={null}
> GET /v1/cron-jobs/{accountId}/logs/{cron_job_id}?start_date=2024-01-25T00:00:00Z&end_date=2024-01-25T23:59:59Z
> ```
>
> Get all executions for a specific day to calculate success rate.

> [accordion] Timeout Issues
>
> ```bash theme={null}
> GET /v1/cron-jobs/{accountId}/logs/{cron_job_id}?status=timeout
> ```
>
> Find all executions that timed out to identify performance issues.

> [accordion] Error Patterns
>
> ```bash theme={null}
> GET /v1/cron-jobs/{accountId}/logs/{cron_job_id}?status=error&limit=50
> ```
>
> Analyze error patterns to improve reliability.

## Understanding Status Codes

**success**

The endpoint returned a 2xx status code

**failure**

The endpoint returned a 4xx or 5xx status code

**error**

Network error or invalid endpoint URL

**timeout**

The request exceeded the configured timeout

## Best Practices

> [!TIP]
>
> 1. **Regular Monitoring**: Check logs daily for critical jobs
> 2. **Set Up Alerts**: Use failure callbacks to get notified immediately
> 3. **Analyze Patterns**: Look for time-based failure patterns
> 4. **Export Important Logs**: Download logs before they expire
> 5. **Calculate Metrics**: Track success rates and response times

## Log Retention

> [!NOTE]
>
> Execution logs are retained for 30 days. Export important logs if you need longer retention.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.