# Oracle API

How PAX markets are resolved, and the oracle API: propose outcomes and challenge proposals with a PAX bond from your platform balance. All curl, no SDK.

**The oracle is on the API host: `https://api.predictasiax.com`** — the same host as trading. Public reads need no key; writes need an api-key carrying the `oracle:write` scope. Unlike the trading API, oracle responses are returned directly (they are *not* wrapped in the `{ data, meta }` envelope). Public reads of providers and attestations do not include account ids.

## How markets are resolved

When a market closes, the platform oracle proposes its outcome. The outcome is public for 2 hours before anyone is paid; anyone can challenge it by locking a PAX bond, and challenges are decided automatically by an independent replay. When the oracle cannot decide a market, anyone can propose its outcome by locking a PAX bond; the proposal is open to challenges for 24 hours. Both can be done at [predictasiax.com/dispute](https://predictasiax.com/dispute) or through this API, with the PAX on your platform balance.

The API and the dispute page are two doors to the same process: a proposal or challenge made here is the same proposal or challenge, with the same bond size, the same automatic judging and the same payout. Nobody decides an outcome by hand.

## Attestations and challenges

- **Attestation** (`att_<n>`) — a proposed outcome for one market. `proposed_by` is `oracle` (the platform oracle's proposal, 2-hour challenge period) or `community` (an account's bonded proposal, 24-hour challenge period). The challenge period ends at `liveness_expires_at_ms`.
- **Challenge** (`chl_<n>`) — a PAX bond against an open attestation. You do not name an outcome: the independent replay re-resolves the market from its source and decides whether the proposed outcome holds.

An attestation's `state`:

- `open` — the challenge period is running.
- `final` — the period is over and every challenge has a verdict. `resolved_outcome` is the outcome that will be paid: the proposed one, or the corrected one when a challenge was upheld.
- `settled` — the market has been paid with `resolved_outcome`.
- `superseded` — withdrawn without payment; `resolution_note` says why. A community attestation that was challenged and that the replay could not confirm ends here, and the market goes back to the oracle.

## Bonds

Bonds are locked from the PAX on your platform balance (your predictasiax.com account) and released or forfeited automatically once the outcome is decided. Nothing is transferred while a bond is locked.

- Base bond — **1000 PAX**.
- New accounts — **3×** while the account is younger than 30 days and has less than $100 of lifetime trading volume.
- Repeat use — **1×, 2×, 4×** for your first, second, and third or later proposal in 30 days; challenges are counted the same way, separately from proposals.
- At most **3** proposals and 3 challenges per account per 24 hours.

Your exact next bond is always in `next_bond_pax` on `GET /v1/oracle/bond-account`, and the bond actually locked is `bond_pax` on the attestation or challenge.

What happens to a proposer bond:

- Paid as proposed — released in full (`bond_state` `released`).
- Outcome corrected by an upheld challenge — forfeited in full (`forfeited`).
- Challenged and not confirmed by the replay — 50% released, 50% forfeited (`split`).
- Withdrawn for any other reason — released in full.

What happens to a challenge bond (`verdict`):

- `shadow_correct` — the challenge is upheld: the bond is refunded in full and the market is paid with `corrected_outcome`.
- `primary_correct` — the replay confirms the proposed outcome: the bond is forfeited.
- `ambiguous` — the replay cannot decide: 50% of the bond is refunded. A challenge that should not have been accepted is closed with a full refund.

Forfeited PAX goes to the platform. There is no bonus: a proposal or challenge that is upheld gets its bond back.

## Authentication

Write endpoints (register, propose, challenge) require an **oracle api-key** with the `oracle:write` scope; reading your own bond account takes any valid api-key. Send it either way:

```
-H "Authorization: Bearer sk_live_..."     # or, equivalently:
-H "X-API-Key: sk_live_..."
```

Public reads (providers, attestations, proposable markets) take no key. The api-key is bound to your PAX user; the gateway resolves your identity from the key and ignores any client-supplied `X-PAX-User-Id` header. Bonds are paid from that user's platform balance, so the key must be minted while signed in on predictasiax.com; otherwise writes return `403 PLATFORM_ACCOUNT_REQUIRED`. Like trading api-keys, an oracle key does not ask for the trading PIN: anyone holding it can lock your PAX in bonds, so store it as you would a trading key.

## Step 1 — Get an oracle api-key

Keys are minted against your platform login. The easiest path is the **Oracle Provider console** in the [builder portal](https://builder.predictasiax.com) — log in, open Oracle Provider, and click to generate. The key is shown once; copy it immediately.

Programmatically, mint with a platform session or a Builder Portal session token (not an api-key, and not an OAuth token a third-party app received):

```
curl -X POST https://api.predictasiax.com/v1/provider/keys \
  -H "Authorization: Bearer <your platform session token>" \
  -H "Content-Type: application/json" \
  -d '{"name":"my-resolver"}'
```

Response — copy `key` immediately, it is shown only once:

```
{
  "key":        "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "key_prefix": "sk_live_a1b2c3",
  "scopes":     ["oracle:write", "read"],
  "name":       "my-resolver",
  "note":       "store this key now; it is shown only once"
}

# Save it:
export OK=sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Each user may hold up to 5 active keys. List them with `GET /v1/provider/keys` and revoke one with `DELETE /v1/provider/keys/{id}` (metadata only — secret material is never returned again).

## Step 2 — Register as a provider (optional)

A provider is a public resolver identity. Proposals you make with its `provider_id` count toward its public record; you can also propose and challenge without one. `adapter_kind` is one of `feed`, `official_source`, `regional_data`, or `manual`; `display_name` is 1–80 characters. One provider per account.

```
curl -X POST https://api.predictasiax.com/v1/oracle/providers \
  -H "Authorization: Bearer $OK" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "Acme Regional Desk",
    "adapter_kind": "regional_data"
  }'
```

Response — `201` with your new provider:

```
{
  "id":                 "ovp_9f8e7d6c5b4a39281706f5e4d3c2b1a0",
  "user_id":            "usr_0011223344556677889900aabbccddee",
  "display_name":       "Acme Regional Desk",
  "adapter_kind":       "regional_data",
  "status":             "active",
  "staked_pax":         "0",
  "attestations_total": "0",
  "disputed_total":     "0",
  "slashed_total":      "0",
  "rewards_pax":        "0",
  "created_at_ms":      1796274000000,
  "updated_at_ms":      1796274000000
}
```

The record updates within about a minute of each change: `attestations_total` counts proposals made with this provider, `staked_pax` is the PAX still locked in them, `disputed_total` counts those that were challenged, and `slashed_total` counts those whose bond was forfeited or split. `rewards_pax` stays `0` (there is no bonus). Anyone can read it with `GET /v1/oracle/providers/{id}`, or list active providers (most-attested first) with `GET /v1/oracle/providers`.

## Step 3 — Check your bond account

Read the PAX available for bonds, what is locked, and the size of your next bonds:

```
curl https://api.predictasiax.com/v1/oracle/bond-account \
  -H "Authorization: Bearer $OK"
```

```
{
  "user_id":       "usr_0011223344556677889900aabbccddee",
  "available_pax": "2500",
  "locked_pax":    "1000",
  "bonds": [
    {
      "kind":           "proposal",
      "attestation_id": "att_42",
      "challenge_id":   null,
      "market_id":      "seed_crypto_7b1702e60e39",
      "bond_pax":       "1000",
      "state":          "locked",
      "created_at_ms":  1798733100000
    }
  ],
  "next_bond_pax": { "proposal": "2000", "challenge": "1000" }
}
```

`bonds` lists the bonds that are still locked. To add PAX, deposit it to your platform balance on predictasiax.com.

## Step 4 — Find markets to propose

You can propose the outcome of a market the oracle could not decide and that has no live proposal. They are public:

```
curl https://api.predictasiax.com/v1/oracle/proposable
```

```
{
  "liveness_secs": 86400,
  "markets": [
    {
      "market_id":       "seed_crypto_7b1702e60e39",
      "title":           "Will BTC close above $100,000 on 31 Dec?",
      "outcomes":        ["YES", "NO"],
      "multi_outcome":   false,
      "settlement_time": "2026-12-31T16:00:00.000Z"
    }
  ]
}
```

`liveness_secs` is the challenge period a community proposal gets. The list is often empty: most markets are decided by the oracle.

## Step 5 — Propose an outcome

`proposed_outcome` is `YES` or `NO`, or one of the market's `outcomes` for a multi-outcome market. `reason` is 20–2000 characters, and `evidence_urls` needs at least one public `http(s)` link that shows the outcome (up to 10). `provider_id` is optional and must be your own active provider.

```
curl -X POST https://api.predictasiax.com/v1/oracle/attestations \
  -H "Authorization: Bearer $OK" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id":        "seed_crypto_7b1702e60e39",
    "proposed_outcome": "YES",
    "reason":           "Official close on 31 Dec was above the threshold.",
    "evidence_urls":    ["https://example.com/official-close"],
    "provider_id":      "ovp_9f8e7d6c5b4a39281706f5e4d3c2b1a0"
  }'
```

Response — `201`; the bond is locked and the challenge period has started:

```
{
  "id":                     "att_42",
  "market_id":              "seed_crypto_7b1702e60e39",
  "proposed_by":            "community",
  "provider_id":            "ovp_9f8e7d6c5b4a39281706f5e4d3c2b1a0",
  "proposed_outcome":       "YES",
  "outcome_index":          null,
  "state":                  "open",
  "liveness_expires_at_ms": 1798819500000,
  "bond_pax":               "1000",
  "bond_state":             "locked",
  "bond_released_pax":      null,
  "bond_forfeited_pax":     null,
  "challenges":             [],
  "resolved_outcome":       null,
  "resolution_note":        null,
  "created_at_ms":          1798733100000,
  "finalized_at_ms":        null,
  "settled_at_ms":          null,
  "updated_at_ms":          1798733100000,
  "note":                   "..."
}
```

If the lock has not completed yet, the response is `202` with `"pending": true`, `bond_pax` and `bond_state` `pending_lock`; the attestation opens within a minute or two. Read it with `GET /v1/oracle/markets/{market_id}/attestation`.

Rejections: `400` `INVALID_REQUEST`, `EVIDENCE_REQUIRED` or `INVALID_OUTCOME` (with the market's `outcomes`); `402 INSUFFICIENT_PAX` (with `bond_pax` and `platform_pax_free` when known); `403 PLATFORM_ACCOUNT_REQUIRED` or `NOT_PROVIDER_OWNER`; `404 MARKET_NOT_FOUND`; `409 NOT_PROPOSABLE`, `ALREADY_PROPOSED`, `DUPLICATE_PROPOSAL` or `PROVIDER_INACTIVE`; `429 RATE_LIMIT_EXCEEDED`. Nothing is locked when a proposal is refused.

## Step 6 — Challenge an open attestation

Any account other than the proposer can challenge an attestation while it is `open`, whether the oracle or the community proposed it. `reason` is 20–2000 characters; `evidence_urls` is optional (up to 10 links).

```
curl -X POST https://api.predictasiax.com/v1/oracle/attestations/att_42/challenge \
  -H "Authorization: Bearer $OK" \
  -H "Content-Type: application/json" \
  -d '{
    "reason":        "The official source shows a close below the threshold.",
    "evidence_urls": ["https://example.com/counter-evidence"]
  }'
```

Response — `200`; the bond is locked and the challenge is decided automatically:

```
{
  "pending": false,
  "challenge": {
    "id":             "chl_311",
    "attestation_id": "att_42",
    "bond_pax":       "1000",
    "state":          "received"
  },
  "attestation": { "id": "att_42", "state": "open", "challenges": [ ... ], "...": "..." },
  "note": "..."
}
```

A `202` with `"pending": true` means the lock is still completing. Rejections: `400` `INVALID_REQUEST` or `OWN_PROPOSAL`; `402 INSUFFICIENT_PAX`; `403 PLATFORM_ACCOUNT_REQUIRED`; `404 NOT_FOUND`; `409 PROPOSAL_NOT_OPEN`, `DISPUTE_WINDOW_CLOSED` or `DUPLICATE_CHALLENGE`; `429 RATE_LIMIT_EXCEEDED`.

## Step 7 — Follow the outcome

These reads are public (no key):

```
# Attestations open for challenges now, soonest deadline first (limit 1-200, default 100)
curl "https://api.predictasiax.com/v1/oracle/attestations?limit=50"

# A single attestation by id
curl https://api.predictasiax.com/v1/oracle/attestations/att_42

# A market's latest attestation, or {"attestation": null}
curl https://api.predictasiax.com/v1/oracle/markets/seed_crypto_7b1702e60e39/attestation
```

After the outcome is decided, the same attestation shows the result and what happened to each bond:

```
{
  "id":                 "att_42",
  "state":              "settled",
  "resolved_outcome":   "YES",
  "bond_state":         "released",
  "bond_released_pax":  "1000",
  "bond_forfeited_pax": "0",
  "challenges": [
    {
      "id":                "chl_311",
      "bond_pax":          "1000",
      "state":             "resolved_forfeited",
      "verdict":           "primary_correct",
      "corrected_outcome": null,
      "created_at_ms":     1798794720000,
      "resolved_at_ms":    1798794840000
    }
  ],
  "finalized_at_ms":    1798819560000,
  "settled_at_ms":      1798819620000,
  "...":                "..."
}
```

## Endpoint reference

Full request/response schemas are in the [REST API reference](https://docs.predictasiax.com/openapi) (tagged *Oracle* and *Provider Keys*). Summary:

- `POST /v1/provider/keys` · `GET /v1/provider/keys` · `DELETE /v1/provider/keys/{id}` — mint, list, revoke keys (session auth)
- `GET /v1/oracle/providers` · `POST /v1/oracle/providers` · `GET /v1/oracle/providers/{id}` — providers
- `GET /v1/oracle/proposable` — markets open for a community proposal
- `POST /v1/oracle/attestations` · `GET /v1/oracle/attestations` · `GET /v1/oracle/attestations/{id}` · `POST /v1/oracle/attestations/{id}/challenge` — attestations
- `GET /v1/oracle/markets/{market_id}/attestation` · `GET /v1/oracle/bond-account` — market view, your bonds

**Writes need PAX on your platform balance, not just a key.** A key whose account has less free PAX than `next_bond_pax` can register a provider and read everything, but cannot propose or challenge.

## Next steps

- [REST API reference](https://docs.predictasiax.com/openapi) — full Oracle + Provider Keys schemas
- [Authentication guide](https://docs.predictasiax.com/auth) — api-keys, scopes, sessions
- [Error codes](https://docs.predictasiax.com/errors) — handle 4xx gracefully
- [Builder portal](https://builder.predictasiax.com) — the Oracle Provider console
- [Request access](https://docs.predictasiax.com/request-access) — gated features

Source: https://docs.predictasiax.com/oracle
