Skip to main content

Ingest tokens

Ingest tokens authenticate agent scans. They are the only way for the agent to send data to the API.

How tokens work​

  1. A user generates a token from the dashboard (+ Add machine or Rescan)
  2. The token is displayed once — copy it immediately
  3. The agent uses the token as a Bearer header: Authorization: Bearer <token>
  4. The token is consumed on first successful ingest
  5. The token cannot be reused

Security properties​

PropertyValue
Length128 characters
Randomnesssecrets.token_urlsafe(48)
LifetimeUntil used (no expiration)
UsageSingle-use (consumed on successful ingest)
ScopeOrganization-level (any machine in the org)

Why single-use?​

Single-use tokens have a smaller attack surface than persistent credentials:

  • A stolen token is worthless after the scan completes
  • No long-lived secret sits on the machine between scans
  • No rotation, revocation, or grace periods to manage
  • Each scan is independently authenticated

Retry behavior​

If a scan is a duplicate (same machine + same scan sequence), the API releases the token so the agent can retry without minting a new one. This handles network errors gracefully.

Generating tokens​

From the dashboard​

  1. Click + Add machine (new machine) or Rescan (existing machine)
  2. Copy the one-liner command that includes the token

From the CLI​

ghostpsy-cli token create ingest <org-slug>

The token is printed to stdout. Use it immediately.