Skip to content

Origin Errors API

The Origin Errors API provides visibility into failed origin requests. Query error logs by pull zone and date to identify DNS failures, timeouts, and other origin issues.

Setup

<?php

require 'vendor/autoload.php';

use ToshY\BunnyNet\BunnyHttpClient;
use ToshY\BunnyNet\Enum\Endpoint;

$bunnyHttpClient = new BunnyHttpClient(
    client: new \Symfony\Component\HttpClient\Psr18Client(),
    // Provide the account API key.
    apiKey: '2cebf4f8-4bff-429f-86f6-bce2c2163d7e89fb0a86-a1b2-463c-a142-11eba8811989',
    baseUrl: Endpoint::ORIGIN_ERRORS
);

Usage

Fetch Origin Errors

Get Origin Errors for PullZone Id and Date

$bunnyHttpClient->request(
    new \ToshY\BunnyNet\Model\Api\OriginErrors\GetOriginErrorLogs(
        pullZoneId: 1,    
        dateTime: (new \DateTime('-1 day'))->format('m-d-y')
    )
);

Reference