PcapAI REST API

Automate PCAP analysis, scale your security workflows, and generate professional PDF reports programmatically.

Advanced Subscription Feature

Authentication

All requests must include a Bearer token. API access is exclusively available for Advanced subscribers. Generate and manage your keys in My Account → API Settings.

# Authentication Header
Authorization: Bearer YOUR_API_KEY

Upload PCAP

POST /api/v1/uploads

A .pcap or .pcapng file goes straight to PcapAI's encrypted storage in Amazon S3 (us-west-2) in three steps:

  1. Open an upload with the file's name and size. You get a signed upload link.
  2. Send the file to that link with a PUT.
  3. Complete the upload. PcapAI checks the file and starts the analysis; you get the job ID for /check and /download.

Request Body (JSON)

  • Field: name File name
  • Field: size Exact file size in bytes
  • Field: mode (optional) security (default), troubleshooting, compliance, forensic, shadow-it

Every analysis includes the network diagnosis (network_diagnostics: verdict, problems with fault domain, evidence and fix steps). mode sets the focus and layout of the PDF report. The size limit is your plan's upload limit (50 MB on Advanced).

Responses

  • 200 OK Upload opened
  • 401 / 403 Missing key / no Advanced plan
  • 413 Payload Too Large Over your plan's limit
  • 415 / 422 Body isn't JSON / a field is missing

JSON Response

{
  "upload_id": "0f6b2f4e-5a0c-4a43-9a2e-3f1c7b8d9e10",
  "upload": {
    "method": "PUT",
    "url": "https://pcap-report-test.s3.us-west-2.amazonaws.com/incoming/0f6b2f4e-...?X-Amz-Signature=...",
    "headers": {},
    "expires_at": "2026-12-01T10:15:00+00:00"
  }
}

Send the file

PUT upload.url

PUT the file's bytes to upload.url, adding any headers listed in upload.headers. No API key: the link itself is the permission. It works for 15 minutes, for this file size only; storage refuses an expired link or a file of another size with 403, and an upload that has started finishes even after the link expires.

Complete the upload

POST /api/v1/uploads/{upload_id}/complete

No body. PcapAI checks that the file arrived, has the size you declared and is a capture, then queues the analysis. Calling it again returns the same answer and never queues the capture twice.

Responses

  • 202 Accepted {"id": "…"}, the job ID
  • 404 Not Found Unknown or expired upload (30 minutes): open a new one
  • 409 Conflict upload_missing: send the file first; upload_checking: retry in a few seconds
  • 415 Unsupported Media Type Not a .pcap or .pcapng capture

Errors are JSON: {"error": "…", "code": "…", "retryable": true}.

All three steps with cURL and jq (bash or zsh, curl 7.76+)

API=https://pcapai.com/api/v1
FILE=capture.pcap

# 1. Open an upload: name, size in bytes, report type
OPEN=$(curl -sS --fail-with-body "$API/uploads" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --arg name "$(basename "$FILE")" --argjson size "$(wc -c < "$FILE")" \
        '{name: $name, size: $size, mode: "troubleshooting"}')")

# 2. Send the file to the signed link
curl -sS --fail-with-body -T "$FILE" "$(jq -r .upload.url <<< "$OPEN")"

# 3. Complete the upload: the answer holds the job ID
ID=$(curl -sS --fail-with-body -X POST \
  "$API/uploads/$(jq -r .upload_id <<< "$OPEN")/complete" \
  -H "Authorization: Bearer $API_KEY" | jq -r .id)
echo "$ID"

Moving from POST /api/v1/upload? The single request with curl -F "[email protected]" still works for now, but it is deprecated (it answers with Deprecation: true) and will be retired. Switch your scripts to the three steps above.

Check Progress

GET /api/v1/check

Poll the processing status of your upload. The analysis and the PDF usually take a few minutes.

Parameter Type Description
id UUID Job ID returned when you complete the upload
curl -H "Authorization: Bearer $API_KEY" \
  "https://pcapai.com/api/v1/check?id=$ID"

It answers 200 {"status": "done"} once the PDF is ready, and 404 {"error": "not found"} until then.

# Wait for the report, then download it
until curl -sf -o /dev/null "$API/check?id=$ID" -H "Authorization: Bearer $API_KEY"; do sleep 10; done
curl -sS --fail-with-body -o report.pdf "$API/download?id=$ID" -H "Authorization: Bearer $API_KEY"

Pro Tip: We recommend exponential backoff for polling (e.g., 2s, 5s, 10s) to optimize resource usage.

Download Report

GET /api/v1/download

Retrieve the finalized AI analysis as a binary PDF stream. Note: Files are automatically deleted 24 hours after upload for security.

curl -L -H "Authorization: Bearer $API_KEY" \
  -o analysis_report.pdf \
  "https://pcapai.com/api/v1/download?id=$ID"
Response Headers 200 OK

Content-Type: application/pdf

Content-Disposition: inline; filename="pcapai-report-<id>.pdf"

Content-Length: 1245082

Ready to automate?

Integrate PcapAI into your incident response pipeline or CI/CD workflows for instant threat intelligence at scale.