Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.signalarc.fun/llms.txt

Use this file to discover all available pages before exploring further.

SignalArc REST API

Primary planned API base URL:
https://api.signalarc.fun
For local development, use http://localhost:4000. The API is currently a local/testnet implementation. The planned production API domain is documented for deployment planning, but live production deployment and DNS are not completed.

API Status

ItemStatus
Production APIPlanned at https://api.signalarc.fun; not live yet.
Local APIImplemented by the Go backend.
AuthenticationNot implemented.
API keysSchema exists, but request enforcement is not implemented.
Content typeapplication/json.
Request IDX-Request-ID is echoed when supplied or generated by middleware.
CORSLocal frontend origins only in current backend code.

Error Format

Errors use a consistent JSON envelope:
{
  "error": {
    "code": "invalid_trade_intent",
    "message": "invalid trade intent"
  }
}

Endpoint Table

MethodPathPurpose
GET/healthProcess health check.
GET/readyzDatabase readiness check.
GET/schema/validateValidate expected schema and migration state.
GET/marketsList markets.
GET/markets/{id}Get one market.
POST/marketsCreate a market record.
POST/trade-intentsCreate a backend trade intent record; does not execute onchain.
GET/agent/marketsAgent-readable market list.
GET/users/{user_id}/positionsList positions for a user.
GET/markets/{market_id}/positionsList positions for a market.
GET/markets/{market_id}/resolutionGet one market resolution.
GET/users/{user_id}/settlementsList settlements for a user.
GET/markets/{market_id}/settlementsList settlements for a market.
GET/arc/contractReturn Arc Testnet contract metadata.

Common Response Shapes

Market

{
  "id": "uuid",
  "creator_user_id": "uuid",
  "title": "Market title",
  "description": null,
  "category": null,
  "status": "OPEN",
  "outcome_yes_label": "YES",
  "outcome_no_label": "NO",
  "collateral_asset": "USDC",
  "chain": "Arc Testnet",
  "resolution_source": null,
  "opens_at": null,
  "closes_at": "2026-06-01T00:00:00Z",
  "resolved_at": null,
  "settled_at": null,
  "winning_outcome": null,
  "created_at": "2026-05-20T00:00:00Z",
  "updated_at": "2026-05-20T00:00:00Z"
}

Trade

{
  "id": "uuid",
  "user_id": "uuid",
  "market_id": "uuid",
  "outcome": "YES",
  "side": "BUY",
  "quantity": "10",
  "price": "0.5",
  "collateral_amount": "5",
  "fee_amount": "0",
  "status": "PENDING",
  "tx_hash": null,
  "created_at": "2026-05-20T00:00:00Z",
  "updated_at": "2026-05-20T00:00:00Z"
}

Endpoints

GET /health

Returns process health.
curl https://api.signalarc.fun/health
Success status: 200 OK Response:
{"status":"ok"}
Known errors: none from handler logic.

GET /readyz

Checks database reachability.
curl https://api.signalarc.fun/readyz
Success status: 200 OK Response:
{"status":"ok"}
Known errors:
StatusCodeMeaning
503database_unavailableDatabase ping failed.

GET /schema/validate

Validates expected database tables and migration state.
curl https://api.signalarc.fun/schema/validate
Success status: 200 OK when schema status is ok. Response:
{
  "status": "ok",
  "migration_version": 13,
  "dirty": false,
  "missing_tables": []
}
Known errors:
StatusCodeMeaning
500schema_validation_failedSchema validation query failed.
503n/aReturned when validation result status is not ok.

GET /markets

Lists up to 50 markets ordered by creation time descending.
curl https://api.signalarc.fun/markets
Success status: 200 OK Response:
{
  "markets": []
}
Known errors:
StatusCodeMeaning
500markets_list_failedMarket list query failed.

GET /markets/

Returns one market by UUID.
curl https://api.signalarc.fun/markets/10000000-0000-4000-8000-000000000003
Success status: 200 OK Response:
{
  "market": {
    "id": "10000000-0000-4000-8000-000000000003",
    "creator_user_id": "10000000-0000-4000-8000-000000000001",
    "title": "Example market",
    "description": null,
    "category": null,
    "status": "OPEN",
    "outcome_yes_label": "YES",
    "outcome_no_label": "NO",
    "collateral_asset": "USDC",
    "chain": "Arc Testnet",
    "resolution_source": null,
    "opens_at": null,
    "closes_at": "2026-06-01T00:00:00Z",
    "resolved_at": null,
    "settled_at": null,
    "winning_outcome": null,
    "created_at": "2026-05-20T00:00:00Z",
    "updated_at": "2026-05-20T00:00:00Z"
  }
}
Known errors:
StatusCodeMeaning
404market_not_foundNo market exists for the supplied id.
500market_get_failedMarket query failed.

POST /markets

Creates a market record. Server-owned lifecycle fields are rejected.
curl -X POST https://api.signalarc.fun/markets \
  -H "Content-Type: application/json" \
  -d '{
    "creator_user_id": "10000000-0000-4000-8000-000000000001",
    "title": "Will SignalArc complete its public docs?",
    "description": "Public documentation readiness market.",
    "category": "product",
    "outcome_yes_label": "YES",
    "outcome_no_label": "NO",
    "collateral_asset": "USDC",
    "chain": "Arc Testnet",
    "resolution_source": "Project repository evidence",
    "closes_at": "2026-06-01T00:00:00Z"
  }'
Request fields:
FieldRequiredNotes
creator_user_idYesUUID-shaped string. Must reference an existing user.
titleYesNon-empty string.
descriptionNoOptional string. Empty string becomes null.
categoryNoOptional string. Empty string becomes null.
outcome_yes_labelNoDefaults to YES.
outcome_no_labelNoDefaults to NO.
collateral_assetNoDefaults to USDC.
chainYesNon-empty string.
resolution_sourceNoOptional string. Empty string becomes null.
opens_atNoRFC3339 timestamp. Must be before closes_at. Future opens_at creates DRAFT; otherwise status is OPEN.
closes_atYesRFC3339 timestamp in the future.
Rejected fields: status, winning_outcome, resolved_at, settled_at. Success status: 201 Created Response:
{
  "market": {
    "id": "uuid",
    "status": "OPEN"
  }
}
Known errors:
StatusCodeMeaning
400invalid_jsonRequest body is not valid JSON.
400invalid_market_requestValidation failed or server-owned lifecycle fields were included.
400invalid_creator_userCreator user foreign key is invalid.
500market_create_failedInsert failed.

POST /trade-intents

Creates a backend trade-intent record. This endpoint is not the primary onchain execution path in the current working tree. The frontend trade panel currently uses the browser wallet to send Arc Testnet approve and openPosition transactions directly. The backend response explicitly marks execution as not_executed.
curl -X POST https://api.signalarc.fun/trade-intents \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "10000000-0000-4000-8000-000000000001",
    "market_id": "10000000-0000-4000-8000-000000000003",
    "outcome": "YES",
    "side": "BUY",
    "quantity": "10",
    "price": "0.5"
  }'
Request fields:
FieldRequiredNotes
user_idYesUUID-shaped string.
market_idYesUUID-shaped string.
outcomeYesYES or NO.
sideYesBUY or SELL.
quantityYesPositive decimal with at most 18 fractional digits and at most 18 significant integer digits.
priceYesDecimal between 0 and 1, with the same decimal bounds.
Success status: 201 Created Response:
{
  "trade": {
    "id": "uuid",
    "status": "PENDING",
    "tx_hash": null
  },
  "execution": {
    "status": "not_executed",
    "reason": "onchain execution is not implemented in Phase 3 backend MVP"
  }
}
Known errors:
StatusCodeMeaning
400invalid_jsonRequest body is not valid JSON.
400invalid_trade_intentRequest validation failed.
400market_not_openMarket exists but status is not OPEN.
404market_not_foundMarket does not exist.
500trade_intent_create_failedLookup or insert failed.

GET /agent/markets

Returns a compact market list for agent-readable discovery and dashboards.
curl https://api.signalarc.fun/agent/markets
Success status: 200 OK Response:
{
  "markets": [
    {
      "id": "uuid",
      "title": "Example market",
      "status": "OPEN",
      "category": "product",
      "collateral_asset": "USDC",
      "chain": "Arc Testnet",
      "closes_at": "2026-06-01T00:00:00Z",
      "resolution_source": "Project repository evidence"
    }
  ]
}
Known errors:
StatusCodeMeaning
500markets_list_failedMarket list query failed.

GET /users//positions

Lists up to 50 positions for a user.
curl https://api.signalarc.fun/users/10000000-0000-4000-8000-000000000001/positions
Success status: 200 OK Response:
{
  "positions": [
    {
      "id": "uuid",
      "user_id": "uuid",
      "market_id": "uuid",
      "outcome": "YES",
      "quantity": "10",
      "average_entry_price": "0.5",
      "realized_pnl": "0",
      "created_at": "2026-05-20T00:00:00Z",
      "updated_at": "2026-05-20T00:00:00Z"
    }
  ]
}
Known errors: 500 positions_list_failed.

GET /markets//positions

Lists up to 50 positions for a market.
curl https://api.signalarc.fun/markets/10000000-0000-4000-8000-000000000003/positions
Success status: 200 OK Known errors: 500 positions_list_failed.

GET /markets//resolution

Returns a market resolution record.
curl https://api.signalarc.fun/markets/10000000-0000-4000-8000-000000000003/resolution
Success status: 200 OK Response:
{
  "resolution": {
    "id": "uuid",
    "market_id": "uuid",
    "winning_outcome": "YES",
    "status": "RESOLVED",
    "resolver_type": "manual",
    "evidence_reference": "Evidence URL or note",
    "resolved_at": "2026-05-20T00:00:00Z",
    "created_at": "2026-05-20T00:00:00Z",
    "updated_at": "2026-05-20T00:00:00Z"
  }
}
Known errors:
StatusCodeMeaning
404resolution_not_foundNo resolution exists for this market.
500resolution_get_failedResolution query failed.

GET /users//settlements

Lists up to 50 settlements for a user.
curl https://api.signalarc.fun/users/10000000-0000-4000-8000-000000000001/settlements
Success status: 200 OK Known errors: 500 settlements_list_failed.

GET /markets//settlements

Lists up to 50 settlements for a market.
curl https://api.signalarc.fun/markets/10000000-0000-4000-8000-000000000003/settlements
Success status: 200 OK Response shape:
{
  "settlements": [
    {
      "id": "uuid",
      "market_id": "uuid",
      "user_id": "uuid",
      "resolution_id": "uuid",
      "outcome": "YES",
      "amount": "10",
      "status": "PENDING",
      "tx_hash": null,
      "settled_at": null,
      "created_at": "2026-05-20T00:00:00Z",
      "updated_at": "2026-05-20T00:00:00Z"
    }
  ]
}
Known errors: 500 settlements_list_failed.

GET /arc/contract

Returns the Arc Testnet prototype contract metadata used by the current local MVP.
curl https://api.signalarc.fun/arc/contract
For local development, use http://localhost:4000:
curl http://localhost:4000/arc/contract
Success status: 200 OK Response:
{
  "network": "Arc Testnet",
  "chain_id": 5042002,
  "signal_arc_market": "0xf4ccc11A9e24fb996679F946C23C04AFd2797F26",
  "usdc_erc20_interface": "0x3600000000000000000000000000000000000000",
  "explorer": "https://testnet.arcscan.app",
  "prototype": true,
  "production_approved": false,
  "status": "prototype_testnet_reference"
}
Known errors: none from handler logic.