Forge Investigation API
Investigations
Operations 6
GET
/api/headless/v1/organizations/{organizationId}/sessions/{sessionId}/compact
Get session compact
#
Investigations
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/forge:forge-investigation-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Forge Investigation API
version: 0.1.0
description: Automate Forge inventory, investigations, findings, governance, fleet, policy, configuration, compliance, MCP, service-account, and audit workflows.
servers:
- url: https://api.forge.ai
description: Forge production API
security:
- serviceAccountBearer: []
tags:
- name: investigation
description: Investigations
paths:
/api/headless/v1/organizations/{organizationId}/sessions:
get:
operationId: listHeadlessSessions
tags:
- investigation
x-forge-audience: public_headless
x-forge-capability-id: investigate.search_activity
x-forge-required-permission: telemetry.read
x-forge-required-scopes:
- investigation:read
x-forge-risk-tier: sensitive_read
x-forge-stability: beta
x-forge-pagination: bounded_query
parameters:
- $ref: '#/components/parameters/OrganizationId'
- name: query
in: query
schema:
type: string
- name: sessionId
in: query
schema:
type: array
items:
type: string
- name: directoryUserId
in: query
schema:
type: array
items:
type: string
- name: deviceId
in: query
schema:
type: array
items:
type: string
- name: integrationId
in: query
schema:
type: array
items:
type: string
- name: productIdentityKey
in: query
schema:
type: array
items:
type: string
- name: gatewayRouteId
in: query
schema:
type: array
items:
type: string
- name: gatewayProviderId
in: query
schema:
type: array
items:
type: string
- name: hasFindingsOnly
in: query
schema:
type: boolean
- name: timeRangeHours
in: query
schema:
type: integer
minimum: 1
maximum: 8760
- name: sort
in: query
schema:
type: string
enum:
- recency
- severity
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 50
- name: cursor
in: query
description: Opaque cursor returned by an indexed evidence-match page.
schema:
type: string
- name: offset
in: query
schema:
type: integer
minimum: 0
responses:
'200':
description: Bounded session search results.
content:
application/json:
schema:
$ref: '#/components/schemas/HeadlessProxyResponse'
'401':
$ref: '#/components/responses/Error'
'403':
$ref: '#/components/responses/Error'
summary: List sessions
description: Search organization sessions, events, findings, and evidence with bounded result windows.
/api/headless/v1/organizations/{organizationId}/sessions/aggregates:
get:
operationId: getHeadlessSessionAggregates
tags:
- investigation
x-forge-audience: public_headless
x-forge-capability-id: investigate.search_activity
x-forge-required-permission: telemetry.read
x-forge-required-scopes:
- investigation:read
x-forge-risk-tier: sensitive_read
x-forge-stability: beta
parameters:
- $ref: '#/components/parameters/OrganizationId'
- name: integrationId
in: query
schema:
type: array
items:
type: string
- name: directoryUserId
in: query
schema:
type: array
items:
type: string
- name: deviceId
in: query
schema:
type: array
items:
type: string
- name: sessionId
in: query
schema:
type: array
items:
type: string
- name: productIdentityKey
in: query
schema:
type: array
items:
type: string
- name: gatewayRouteId
in: query
schema:
type: array
items:
type: string
- name: gatewayProviderId
in: query
schema:
type: array
items:
type: string
- name: gatewaySubjectId
in: query
schema:
type: array
items:
type: string
- name: hasFindingsOnly
in: query
schema:
type: boolean
- name: timeRangeHours
in: query
schema:
type: integer
minimum: 1
maximum: 8760
- name: timeZone
in: query
schema:
type: string
- name: includeDirectoryUsers
in: query
schema:
type: boolean
responses:
'200':
description: Exact server-computed activity totals and bounded breakdowns.
content:
application/json:
schema:
$ref: '#/components/schemas/HeadlessProxyResponse'
'202':
description: Metrics are being prepared. Retry after the indicated delay.
headers:
Retry-After:
schema:
type: integer
minimum: 1
content:
application/json:
schema:
$ref: '#/components/schemas/HeadlessProxyResponse'
'401':
$ref: '#/components/responses/Error'
'403':
$ref: '#/components/responses/Error'
summary: Get session aggregates
description: Search organization sessions, events, findings, and evidence with bounded result windows.
/api/headless/v1/organizations/{organizationId}/llm-gateway/usage:
get:
operationId: getHeadlessLlmGatewayUsage
tags:
- investigation
x-forge-audience: public_headless
x-forge-capability-id: llm_gateway.usage.read
x-forge-required-permission: telemetry.read
x-forge-required-scopes:
- investigation:read
x-forge-risk-tier: sensitive_read
x-forge-stability: beta
parameters:
- $ref: '#/components/parameters/OrganizationId'
- name: window
in: query
schema:
type: string
enum:
- 30d
- all_time
- name: excludeDimensions
in: query
description: Comma-separated cost rollup dimensions to omit. Supports session and policy_outcome, ignoring case, surrounding whitespace, duplicates, and empty entries. Omitted or empty values return all dimensions. Scalar metrics are unchanged. A selected dimension that is also excluded returns no cost rollups.
schema:
type: string
maxLength: 256
- name: dimension
in: query
schema:
type: string
enum:
- token
- profile
- user
- group
- service_account
- group_inclusive
- provider
- model
- session
- policy_outcome
- name: query
in: query
schema:
type: string
- name: limit
in: query
required: true
schema:
type: integer
minimum: 1
maximum: 50
responses:
'200':
description: Forge LLM Gateway-observed usage, cost, and bounded rollups.
content:
application/json:
schema:
$ref: '#/components/schemas/HeadlessProxyResponse'
'400':
$ref: '#/components/responses/Error'
'401':
$ref: '#/components/responses/Error'
'403':
$ref: '#/components/responses/Error'
summary: Get llm gateway usage
description: Read usage, token, cost, and policy outcome aggregates observed by Forge LLM Gateway.
/api/headless/v1/organizations/{organizationId}/sessions/{sessionId}/compact:
get:
operationId: getHeadlessSessionCompact
tags:
- investigation
x-forge-audience: public_headless
x-forge-capability-id: investigate.get_session
x-forge-required-permission: telemetry.read
x-forge-required-scopes:
- investigation:read
x-forge-risk-tier: sensitive_read
x-forge-stability: beta
parameters:
- $ref: '#/components/parameters/OrganizationId'
- name: sessionId
in: path
required: true
schema:
type: string
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 500
default: 100
- name: cursor
in: query
schema:
type: string
- name: occurrenceDeviceId
in: query
description: Exact stored device identity. Adjacent cursors preserve this scope.
schema:
type: string
- name: occurrenceScope
in: query
description: Select messages without a single proved device. Cannot be combined with occurrenceDeviceId.
schema:
type: string
enum:
- unattributed
- name: order
in: query
schema:
type: string
enum:
- asc
- desc
default: asc
- name: aroundMessageId
in: query
description: Stable normalized Message identity to center in a bounded Compact window. Cannot be combined with cursor.
schema:
type: string
responses:
'200':
description: Normalized effective messages with stored parent links, content-access state and opaque generation cursors, or an explicit occurrence-group selection.
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/SessionMessagePage'
- $ref: '#/components/schemas/SessionMessageSelectionRequired'
'400':
$ref: '#/components/responses/Error'
'401':
$ref: '#/components/responses/Error'
'403':
$ref: '#/components/responses/Error'
'404':
$ref: '#/components/responses/Error'
summary: Get session compact
description: Fetch session summaries, compact evidence, and timeline details with redaction and pagination.
/api/headless/v1/organizations/{organizationId}/entities:
get:
operationId: listHeadlessEntities
tags:
- investigation
x-forge-audience: public_headless
x-forge-capability-id: entities.read
x-forge-required-permission: telemetry.read
x-forge-required-scopes:
- entities:read
x-forge-risk-tier: sensitive_read
x-forge-stability: beta
parameters:
- $ref: '#/components/parameters/OrganizationId'
- name: limit
in: query
description: Maximum entities to return. Omit to return the complete list.
schema:
type: integer
minimum: 1
maximum: 50
- name: offset
in: query
description: Entities to skip in the sorted list. Requires limit.
schema:
type: integer
minimum: 0
responses:
'200':
description: Entity inventory.
content:
application/json:
schema:
$ref: '#/components/schemas/HeadlessProxyResponse'
'400':
$ref: '#/components/responses/Error'
'401':
$ref: '#/components/responses/Error'
'403':
$ref: '#/components/responses/Error'
summary: List entities
description: List and fetch entity profiles with bounded, redacted evidence summaries.
/api/headless/v1/organizations/{organizationId}/entities/{entityId}:
get:
operationId: getHeadlessEntity
tags:
- investigation
x-forge-audience: public_headless
x-forge-capability-id: entities.read
x-forge-required-permission: telemetry.read
x-forge-required-scopes:
- entities:read
x-forge-risk-tier: sensitive_read
x-forge-stability: beta
parameters:
- $ref: '#/components/parameters/OrganizationId'
- name: entityId
in: path
required: true
schema:
type: string
responses:
'200':
description: Entity detail.
content:
application/json:
schema:
$ref: '#/components/schemas/HeadlessProxyResponse'
'401':
$ref: '#/components/responses/Error'
'403':
$ref: '#/components/responses/Error'
'404':
$ref: '#/components/responses/Error'
summary: Get entity
description: List and fetch entity profiles with bounded, redacted evidence summaries.
components:
schemas:
MessageKind:
type: string
enum:
- prompt.submitted
- tool.called
- tool.completed
- response.generated
- task.started
- task.completed
- context.compacted
- context.provided
- exchange.failed
x-enum-varnames:
- MessageKindPromptSubmitted
- MessageKindToolCalled
- MessageKindToolCompleted
- MessageKindResponseGenerated
- MessageKindTaskStarted
- MessageKindTaskCompleted
- MessageKindContextCompacted
- MessageKindContextProvided
- MessageKindExchangeFailed
SessionMessageSelectionRequired:
type: object
additionalProperties: false
required:
- selectionRequired
- cohorts
properties:
unresolvedMessageCount:
type: integer
minimum: 0
selectionRequired:
type: boolean
enum:
- true
cohorts:
type: array
items:
$ref: '#/components/schemas/SessionMessageCohort'
MessageCompletionStatus:
type: string
enum:
- succeeded
- failed
- cancelled
- timed_out
- interrupted
- unknown
x-enum-varnames:
- MessageCompletionStatusSucceeded
- MessageCompletionStatusFailed
- MessageCompletionStatusCancelled
- MessageCompletionStatusTimedOut
- MessageCompletionStatusInterrupted
- MessageCompletionStatusUnknown
HeadlessProxyResponse:
type: object
additionalProperties: true
SessionContentAccessState:
type: object
required:
- state
properties:
state:
type: string
enum:
- unrestricted
- locked
- granted
grantId:
type: string
grantExpiresAt:
type: string
format: date-time
requestId:
type: string
additionalProperties: false
SessionMessageReasoning:
description: Source-confirmed reasoning, separate from an ordinary answer. When contentAvailable is false the source contained no readable reasoning; placeholder text is omitted from content. Original audit evidence is retained.
type: object
additionalProperties: false
required:
- contentAvailable
properties:
contentAvailable:
type: boolean
SessionMessageOutcome:
type: object
additionalProperties: false
required:
- id
- policyId
- policyVersion
- action
properties:
id:
type: string
policyId:
type: string
policyVersion:
type: integer
format: int64
minimum: 1
action:
type: string
enum:
- allow
- block
- redact
- filter
- require_approval
- flag_for_review
- nudge
violationId:
type: string
SessionMessage:
description: One normalized session occurrence with effective content and its policy evaluations. Backend attribution and source proof are never exposed by this customer-facing contract. Completion status is present only for tool.completed, task.completed and exchange.failed. Cancelled exchanges may retain observed partial text and reasoning. Other exchange failures are contentless lifecycle events. Tool name is present only for tool.called. When taskId is present, task carries the exact stored label and parent reference; producers may leave either unset.
type: object
additionalProperties: false
required:
- id
- organizationId
- sessionId
- ordinal
- kind
- actor
- occurredAt
- governance
properties:
id:
type: string
organizationId:
type: string
sessionId:
type: string
ordinal:
type: integer
format: int64
minimum: 1
kind:
$ref: '#/components/schemas/MessageKind'
actor:
$ref: '#/components/schemas/Actor'
parentMessageId:
type: string
toolCallId:
type: string
toolName:
type: string
taskId:
type: string
task:
$ref: '#/components/schemas/Task'
model:
type: string
requestedModel:
description: Explicit model selector observed on this prompt, absent when omitted.
type: string
requestedReasoningEffort:
description: Explicit requested effort observed on this prompt, without a claim about served effort.
type: string
reasoning:
$ref: '#/components/schemas/SessionMessageReasoning'
content:
type: array
minItems: 1
items:
$ref: '#/components/schemas/MessageContentPart'
status:
$ref: '#/components/schemas/MessageCompletionStatus'
statusReason:
type: string
governance:
type: array
items:
$ref: '#/components/schemas/SessionMessageGovernance'
dataContext:
type: array
items:
$ref: '#/components/schemas/DataContextActivityResource'
occurredAt:
type: string
format: date-time
DataContextActivityResource:
type: object
required:
- id
- providerKey
- dataSourceKind
- displayName
- proofStrength
properties:
id:
type: string
providerKey:
type: string
sourceFamily:
type: string
sourceAdapterKey:
type: string
dataSourceKind:
type: string
displayName:
type: string
resourceUrl:
type: string
labels:
type: array
items:
type: string
classifications:
type: array
items:
type: string
providerActions:
type: array
items:
type: string
matchProof:
type: string
proofStrength:
type: string
hasUnresolvedSensitiveContent:
type: boolean
SessionMessageAnchor:
type: object
additionalProperties: false
required:
- requestedMessageId
- available
properties:
requestedMessageId:
type: string
available:
type: boolean
resolvedMessageId:
type: string
index:
type: integer
minimum: 0
MessageContentPartKind:
type: string
enum:
- text
- reasoning
- image
- audio
- file
- json
x-enum-varnames:
- MessageContentPartKindText
- MessageContentPartKindReasoning
- MessageContentPartKindImage
- MessageContentPartKindAudio
- MessageContentPartKindFile
- MessageContentPartKindJSON
MessageResponse:
type: object
required:
- message
properties:
message:
type: string
MessageContentPart:
type: object
additionalProperties: false
required:
- id
- ordinal
- kind
properties:
id:
type: string
ordinal:
type: integer
format: int64
minimum: 1
kind:
$ref: '#/components/schemas/MessageContentPartKind'
mediaType:
type: string
textValue:
type: string
jsonValue: {}
labels:
type: array
uniqueItems: true
items:
type: string
SessionMessageCohort:
type: object
additionalProperties: false
required:
- occurrenceDeviceId
- firstAcceptedAt
- lastAcceptedAt
- messageCount
properties:
occurrenceDeviceId:
type: string
minLength: 1
firstAcceptedAt:
type: string
format: date-time
lastAcceptedAt:
type: string
format: date-time
messageCount:
type: integer
minimum: 1
Actor:
description: Customer-visible responsible actor. Attribution state and source evidence are backend-only and are never exposed by this contract.
oneOf:
- type: object
additionalProperties: false
required:
- id
- kind
properties:
id:
type: string
kind:
type: string
enum:
- human
displayName:
type: string
directoryUserId:
type: string
- type: object
additionalProperties: false
required:
- id
- kind
- workloadId
properties:
id:
type: string
kind:
type: string
enum:
- workload
displayName:
type: string
workloadId:
type: string
- type: object
additionalProperties: false
required:
- id
- kind
properties:
id:
type: string
kind:
type: string
enum:
- unknown
displayName:
type: string
SessionMessageGovernance:
type: object
additionalProperties: false
required:
- id
- policyFamily
- mode
- result
- evaluatedAt
- outcomes
properties:
id:
type: string
controlPointEventId:
type: string
description: Present when this is a reference to an existing request-owned evaluation. Its ownership and identity remain on this control point; it is not a separate evaluation of the displayed message.
policyFamily:
type: string
enum:
- content
- access
- resource
- skill_acl
- watcher
mode:
type: string
enum:
- enforcing
- observing
result:
type: string
enum:
- matched
- no_match
- unevaluable
- not_configured
- failed
evaluatedAt:
type: string
format: date-time
outcomes:
type: array
items:
$ref: '#/components/schemas/SessionMessageOutcome'
SessionMessagePage:
description: One bounded, snapshot-stable window of normalized session messages. Raw, Compact, and Replay use this same public shape and differ only in presentation and authorization.
type: object
additionalProperties: false
required:
- contentAccess
- messages
properties:
occurrenceScope:
type: string
enum:
- unattributed
occurrenceDeviceId:
type: string
contentAccess:
$ref: '#/components/schemas/SessionContentAccessState'
messages:
type: array
maxItems: 500
items:
$ref: '#/components/schemas/SessionMessage'
previousCursor:
type: string
nextCursor:
type: string
anchor:
$ref: '#/components/schemas/SessionMessageAnchor'
snapshotId:
type: string
generation:
type: string
newerMessagesAvailable:
type: boolean
Task:
type: object
additionalProperties: false
required:
- id
properties:
id:
type: string
parentTaskId:
type: string
label:
type: string
parameters:
OrganizationId:
name: organizationId
in: path
required: true
schema:
type: string
responses:
Error:
description: Stable Forge error envelope.
content:
application/json:
schema:
$ref: '#/components/schemas/MessageResponse'
securitySchemes:
serviceAccountBearer:
type: http
scheme: bearer
bearerFormat: Forge service-account or delegated OAuth access token
description: Enter a Forge service-account token or delegated OAuth access token. Mintlify adds the Bearer prefix.
x-forge-audience: public_headless
x-forge-stability: beta