{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arcnautical-com/json-schema/arcnautical-com-export-request-schema.json",
  "title": "ExportRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arcnautical-com-exports-api-openapi.yml#/components/schemas/ExportRequest",
  "type": "object",
  "required": [
    "resource"
  ],
  "properties": {
    "resource": {
      "$ref": "#/$defs/ExportResource"
    },
    "format": {
      "type": "string",
      "enum": [
        "csv",
        "jsonl"
      ],
      "default": "csv",
      "description": "csv is a flat summary with a UTF-8 BOM, for a spreadsheet. jsonl is one complete record per line — for screenings that is the full evidence, identical to GET /api/v1/screenings/{id}, including match detail and per-source freshness the CSV cannot carry."
    },
    "filters": {
      "type": "object",
      "description": "A filter that does not apply to the chosen resource is rejected, never ignored — an export that quietly dropped a filter would hand you a wrong file with nothing to show anything went wrong.",
      "properties": {
        "created_after": {
          "type": "string",
          "format": "date-time",
          "description": "Inclusive lower bound."
        },
        "created_before": {
          "type": "string",
          "format": "date-time",
          "description": "Inclusive upper bound. Defaults to the moment of the request, and is echoed back."
        },
        "imo": {
          "type": "string",
          "description": "screenings, cargo_screenings."
        },
        "customer_reference": {
          "type": "string",
          "description": "screenings, cargo_screenings."
        },
        "sanctions_status": {
          "type": "string",
          "enum": [
            "RED",
            "AMBER",
            "INCOMPLETE",
            "GREEN"
          ],
          "description": "screenings. \"Export everything that came back RED\" — the auditor's question, answered inside the artifact whose SHA-256 we publish, rather than by filtering the file afterwards. A value outside this list is a 422, never an empty file: zero rows and \"nothing was RED\" must not be the same answer."
        },
        "status": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            {
              "type": "string",
              "enum": [
                "CRITICAL",
                "WARNING",
                "OK"
              ]
            }
          ],
          "description": "access_log: the HTTP status code, e.g. 403 for every refusal. cargo_screenings: the published cargo verdict. Same name, two resources, two vocabularies — a value of the wrong kind is rejected rather than matched against nothing."
        },
        "outcome": {
          "type": "string",
          "enum": [
            "success",
            "failure"
          ],
          "description": "access_log."
        },
        "method": {
          "type": "string",
          "description": "access_log."
        },
        "endpoint": {
          "type": "string",
          "description": "access_log. Templated path, e.g. /api/v1/screenings/{id}."
        },
        "key_id": {
          "type": "string",
          "format": "uuid",
          "description": "access_log."
        }
      }
    }
  },
  "$defs": {
    "ExportResource": {
      "type": "string",
      "description": "What to export. Each is governed by the same scope that governs reading it one record at a time: screenings by vessel:screen, cargo_screenings by cargo:screen, access_log by logs:read.",
      "enum": [
        "screenings",
        "cargo_screenings",
        "access_log",
        "voyage_assessments"
      ]
    }
  }
}