{% extends "base.html" %} {% import "_ui.html" as ui %} {% block title %}API{% endblock %} {% block crumbs %}API reference{% endblock %} {% block content %} {%- set auth = "-u USER:PASSWORD " if needs_auth else "" -%} {%- macro fill(path) -%}{{ path.replace("{run_id}", samples.run_id or "{run_id}").replace("{jid}", samples.jid or "{jid}") }}{%- endmacro -%} {%- macro curl(e) -%} {%- set url = base ~ fill(e.path) -%} {%- if e.method == "GET" -%} curl {{ auth }}{{ "-OJ " if e.path.endswith(("download", ".jsonl")) }}"{{ url }}" {%- else -%} curl {{ auth }}-X POST "{{ url }}"{% for f in e.fields if f.where in ("form", "file") %} \ -F {% if f.where == "file" %}"{{ f.name }}=@report.pdf"{% else %}"{{ f.name }}=<{{ f.type or "value" }}>"{% endif %}{% endfor %} {%- endif -%} {%- endmacro -%}

API reference

Drive ti2dac from a SOAR playbook, CI pipeline or script: start analyses, poll jobs, pull rules and queries, and record reviews and test results. Every action in this UI is an HTTP call you can make yourself.

{{ ui.icon("download", "sm") }}openapi.json
{{ ui.icon("key") }}
Authentication
{% if needs_auth %}HTTP Basic auth with a ti2dac user (ti2dac user add). Approvals need the approver role. {% else %}Local single-user mode: no login, loopback only. Add users with ti2dac user add before exposing the server.{% endif %}
{{ ui.icon("shield") }}
Conventions
Actions take form fields (-F) and answer 303 with a Location; long work returns a job to poll at /api/jobs/{jid}. Cross-origin browser posts are refused; scripts without an Origin header are fine.
{% for key, title, ico, desc in [ ("json", "JSON API", "api", "Read-only, machine-friendly. Start here for integrations."), ("actions", "Actions", "zap", "State-changing calls, the same ones the UI's forms make."), ("files", "Files & exports", "download", "Generated artefacts and datasets.")] if groups[key] %}

{{ ui.icon(ico) }}{{ title }} {{ groups[key]|length }}

{{ desc }}

{% endfor %}

{{ ui.icon("play") }}Typical automation

Analyse a report, wait for the job, then fetch the rules.

{{ ui.code('# 1. start an analysis (prints the job URL in the Location header) curl -s -o /dev/null -w "%{redirect_url}\\n" ' ~ auth ~ '-X POST "' ~ base ~ '/runs" -F "url=https://thedfirreport.com/..." -F "count=3" # 2. poll the job until status is "done", then read run_id curl -s ' ~ auth ~ '"' ~ base ~ '/api/jobs/" # 3. fetch the run record (rules, queries, review status) or the shareable package curl -s ' ~ auth ~ '"' ~ base ~ '/api/runs/" curl -OJ ' ~ auth ~ '"' ~ base ~ '/runs//download"') }}
{% endblock %}