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

# Developer Logs

> Access and interpret API logs in the Topsort admin platform

## Where to Find Logs

Navigate to **Dev Tools** tab in your Topsort Ad Platform to access real-time logs for your API key.

## Log Availability

| Environment    | What's Logged                   | Retention |
| -------------- | ------------------------------- | --------- |
| **Staging**    | All API requests and responses  | 30 days   |
| **Production** | Errors and failed requests only | 30 days   |

<Note>
  As your production API usage scales up, successful requests may be filtered from logs to improve performance. Errors and debugging information will always be available.
</Note>

## Understanding Log Entries

### Successful Requests

<img src="https://mintcdn.com/topsort/oVmv62U7qVFoTD_d/en/api-reference/5a7e3e4-87895af-Schema-validator-notification.webp?fit=max&auto=format&n=oVmv62U7qVFoTD_d&q=85&s=430bfba5e57697b63ab0eaa29747322a" alt="Schema validator notification screenshot" width="1278" height="951" data-path="en/api-reference/5a7e3e4-87895af-Schema-validator-notification.webp" />

Successful API calls show:

* **Status:** HTTP 200/201/204 status codes
* **Timestamp:** When the request was made
* **Endpoint:** Which API endpoint was called
* **Response time:** How long the request took
* **Request size:** Size of request/response data

### Error Entries

<img src="https://mintcdn.com/topsort/1RZV69Uhic79Ylqv/en/api-reference/bcb6eb0-b5dedc7-Schema-validator-error.webp?fit=max&auto=format&n=1RZV69Uhic79Ylqv&q=85&s=1562f907c238249ec7141353afe2ab00" alt="Schema validator error screenshot" width="1297" height="463" data-path="en/api-reference/bcb6eb0-b5dedc7-Schema-validator-error.webp" />

Failed requests include additional debugging information:

* **Status:** HTTP error code (400, 401, 403, etc.)
* **Error details:** Specific error code and message
* **Request body:** What data was sent (for debugging)
* **Stack trace:** Internal error details (when available)

## Common Log Patterns

### Authentication Issues

```
401 Unauthorized - invalid_api_key
Missing Authorization header
```

**Solution:** Add `Authorization: Bearer YOUR_API_KEY` header

### Validation Errors

```
422 Unprocessable Entity - invalid_product_id
Product 'sku_123' not found in catalog
```

**Solution:** Verify product exists and is spelled correctly

### Rate Limiting

```
429 Too Many Requests - rate_limited
X-RateLimit-Remaining: 0
```

**Solution:** Implement exponential backoff retry logic

## Using Logs for Debugging

### 1. Events Not Appearing in Dashboard

Look for:

* **200 status** on `/events` calls
* **Validation errors** in event payload
* **Timestamp issues** (`occurredAt` in future or too old)

### 2. Empty Auction Results

Check:

* Campaign budget status
* Product availability in catalog
* Auction request format

### 3. Attribution Problems

Review event logs for:

* Consistent user ID usage
* Proper `resolvedBidId` from auctions
* Timing of click/purchase events

## Best Practices

### Log Monitoring

* Check logs after deploying new integration code
* Monitor error rates during high-traffic periods
* Set up alerts for recurring error patterns

### Troubleshooting Workflow

1. **Reproduce the issue** in staging environment
2. **Check recent logs** for error patterns
3. **Verify request format** against [API documentation](/api-reference)
4. **Test with minimal payload** to isolate the problem
5. **Contact support** with log timestamps for complex issues

## Privacy and Data Handling

* Logs may contain sensitive data from your requests
* Production logs automatically expire after 30 days
* Access to logs is restricted to admin users only
* Personal data in logs follows standard data retention policies

## Need Help?

If you're seeing persistent errors in your logs:

1. **Note the timestamp** of problematic requests
2. **Copy the exact error message** and request details
3. **Contact support** with this information for faster resolution

Our team can access detailed server-side logs to help diagnose complex integration issues.
