Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Event catalogue

    Receive a completion event and read the authoritative run.

    Subscribe to com.rdcopilot.reports.run.completed.v1. It is emitted after the run result is recorded. The envelope identifies the organization, company, run revision, actor and causal operation. Its data carries runId, questionId and sourceRevision.

    curl

    curl -X POST "$RDC_BASE_URL/reports/v1/subscriptions" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "41800000-0000-4000-8000-000000000136",
      "expectedRevision": 0,
      "id": "management-events",
      "endpoint": "https://receiver.example/events",
      "eventTypes": [
        "com.rdcopilot.reports.run.completed.v1"
      ]
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/subscriptions`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "41800000-0000-4000-8000-000000000136",
        "expectedRevision": 0,
        "id": "management-events",
        "endpoint": "https://receiver.example/events",
        "eventTypes": [
          "com.rdcopilot.reports.run.completed.v1"
        ]
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/reports/v1/subscriptions',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '41800000-0000-4000-8000-000000000136',
            'expectedRevision': 0,
            'id': 'management-events',
            'endpoint': 'https://receiver.example/events',
            'eventTypes': [
                'com.rdcopilot.reports.run.completed.v1',
            ],
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "41800000-0000-4000-8000-000000000136",
      "expectedRevision": 0,
      "id": "management-events",
      "endpoint": "https://receiver.example/events",
      "eventTypes": [
        "com.rdcopilot.reports.run.completed.v1"
      ]
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/subscriptions');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/reports/v1/subscriptions");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "41800000-0000-4000-8000-000000000136",
      "expectedRevision": 0,
      "id": "management-events",
      "endpoint": "https://receiver.example/events",
      "eventTypes": [
        "com.rdcopilot.reports.run.completed.v1"
      ]
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "41800000-0000-4000-8000-000000000136",
      "status": "completed",
      "aggregateRevision": 1,
      "secret": "whsec_dGVzdC1zaWduaW5nLXNlY3JldC1yZXBvcnRz"
    }

    Verify each delivery signature over the raw body with the subscription secret. Persist the event id before acknowledging it; duplicate deliveries retain that id. Read the run with your account token before updating dependent reports. Delivery order is not a freshness guarantee.

    curl

    curl "$RDC_BASE_URL/reports/v1/runs/41800000-0000-4000-8000-000000000002" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/runs/41800000-0000-4000-8000-000000000002`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/reports/v1/runs/41800000-0000-4000-8000-000000000002',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/runs/41800000-0000-4000-8000-000000000002');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        ],
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/reports/v1/runs/41800000-0000-4000-8000-000000000002");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "id": "41800000-0000-4000-8000-000000000002",
      "revision": 1,
      "questionId": "revenue-by-product",
      "questionRevision": 1,
      "status": "completed",
      "filters": {
        "period": "2026-10",
        "companyId": null,
        "department": null
      },
      "sourceRevision": 1,
      "refreshedAt": "2026-11-22T06:00:00Z",
      "rows": [
        {
          "key": "food",
          "netRevenue": "142063.00",
          "invoiceIds": [
            "FCT-2026-00418",
            "BRR-2026-00127"
          ]
        },
        {
          "key": "household",
          "netRevenue": "60735.50",
          "invoiceIds": [
            "FCT-2026-00436"
          ]
        }
      ],
      "errorCode": null
    }

    Use Delivery and retries for receiver behavior and Replay for parked deliveries. The catalogue contains only the event type this contract accepts.