Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API 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. See our Privacy Policy and
Terms.
openapi: 3.2.0
info:
title: Foresea Intelligence Webhooks API
description: '## Overview
The **Foresea Intelligence API** turns market questions, linked evidence, and
prediction-market prices into probabilistic forecasts that can sit behind
trading dashboards, alerting systems, and research workflows. It supports binary, multiple-choice, numeric, and date forecasts. Each response
includes a structured **rationale**, typed forecast fields, optional evidence
sources fetched from live news, and optional market-edge analysis when you pass
a market-implied probability. ---
## Quick start
```bash
curl -X POST https://foresea.ink/predict \
-H "Content-Type: application/json" \
-d ''{
"question": "Will the Fed cut rates before September 30, 2026?",
"question_type": "binary",
"market_platform": "Polymarket",
"market_probability": 0.54,
"variant": "variant0_neutral_baseline"
}''
```
---
## Question types
Use `question_type` when your client already knows the shape of the question. If omitted, the model will try to infer it. | Type | Response shape |
|---|---|
| `binary` | `predicted_answer` is `Yes`/`No`; `confidence` is 0–1 |
| `multiple_choice` | `options` contains per-option probabilities; `predicted_answer` is the top option |
| `numeric` | `range_forecast` contains `p10`, `p50`, `p90`, and optional `unit` |
| `date` | `range_forecast` contains date percentiles |
For multiple-choice forecasts, pass `options` when the answer set is known. ---
## Prediction-market context
Pass `market_probability` when you know the current market-implied probability
for the target outcome. For binary markets this defaults to the `Yes` side; set
`market_outcome` to compare against `No` or a named multiple-choice outcome. Foresea returns `market_analysis` with model probability, market probability,
percentage-point edge, and a stance (`model_above_market`, `model_below_market`,
`in_line`, or `not_comparable`). ---
## Trading execution
Foresea can preview and submit guarded orders for Kalshi and Polymarket:
| Endpoint | Purpose |
|---|---|
| `GET /trading/accounts` | Return configured/not-configured server-account status without exposing secrets |
| `POST /trading/accounts/check` | Validate caller-supplied own-account (BYO) credentials without storing them |
| `POST /trading/preview` | Normalize and validate an order without placing it |
| `POST /trading/orders` | Submit a live order after explicit confirmation |
Live trading is disabled unless `FORESEA_ENABLE_TRADING=true`. Every live order
requires a signed-in user session, `execute=true`, and the exact confirmation
phrase `PLACE REAL ORDER`. Market/IOC/FOK-style orders are separately blocked
unless `FORESEA_ALLOW_MARKET_ORDERS=true`. Exchange credentials come from a shared server account (environment variables /
Secret Manager mounts) or an authenticated user''s **encrypted account
connection**. The connection endpoint accepts a user''s credentials once, validates
them with a unique data-encryption key wrapped by Cloud KMS, and never returns
them to the browser. Inline `venue_credentials` are rejected on public preview
and order calls; encrypted own-account trading remains gated by
`FORESEA_ENABLE_BYO_TRADING=true` (independent of `FORESEA_ENABLE_TRADING`). `/agent/analyze` may return a directional recommendation, but it never places an
order. Use `/trading/preview` first, review the normalized order, then call
`/trading/orders` only when you intend to submit a real order. ---
## Prompt variants
The `variant` field controls how the LLM is prompted.'
contact:
name: Pareel Amre
url: https://foresea.ink/
email: pareel.amre@gmail.com
license:
name: MIT
url: https://opensource.org/licenses/MIT
version: 1.0.0
tags:
- name: Webhooks
paths:
/webhooks/subscribe:
post:
tags:
- Webhooks
summary: Subscribe an external agent callback webhook for real-time market events
description: Register an automated webhook callback. The response contains an HMAC secret (X-Foresea-Signature) for validating payloads.
operationId: webhook_subscribe_webhooks_subscribe_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookSubscribeRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookSubscribeResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/webhooks/subscriptions:
get:
tags:
- Webhooks
summary: List active webhook subscriptions
description: List all registered webhook subscriptions.
operationId: webhook_list_subscriptions_webhooks_subscriptions_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Webhook List Subscriptions Webhooks Subscriptions Get
/webhooks/subscriptions/{sub_id}:
delete:
tags:
- Webhooks
summary: Unsubscribe an external agent webhook
description: Delete a registered webhook subscription.
operationId: webhook_delete_subscription_webhooks_subscriptions__sub_id__delete
parameters:
- name: sub_id
in: path
required: true
schema:
type: string
title: Sub Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Webhook Delete Subscription Webhooks Subscriptions Sub Id Delete
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
WebhookSubscribeResponse:
properties:
id:
type: string
title: Id
url:
type: string
title: Url
events:
items:
type: string
type: array
title: Events
secret:
type: string
title: Secret
min_edge:
type: number
title: Min Edge
created_at:
type: string
title: Created At
active:
type: boolean
title: Active
status:
type: string
title: Status
default: registered
type: object
required:
- id
- url
- events
- secret
- min_edge
- created_at
- active
title: WebhookSubscribeResponse
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
WebhookSubscribeRequest:
properties:
url:
type: string
maxLength: 500
title: Url
description: Destination webhook callback URL (https/http)
events:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Events
description: 'Events to subscribe to: ''edge_alert'', ''market_resolution'', ''new_market'', ''all'''
min_edge:
type: number
maximum: 1.0
minimum: 0.0
title: Min Edge
description: Minimum edge threshold for edge_alert events
default: 0.08
type: object
required:
- url
title: WebhookSubscribeRequest
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError