Skip to main content
Generate Twitter intent URLs for multiple markets in a single request. Useful for building custom UIs with multiple prediction buttons.

Endpoint

POST https://app.kash.bot/api/twitter-links

Request Body

{
  "markets": [
    { "marketId": "abc123", "side": "yes", "amount": 25 },
    { "marketId": "def456", "side": "no", "amount": 50 }
  ]
}
markets
array
required
Array of market prediction requests (max 50)

Response

Successfully generated links
errors
array
Failed requests with error messages

Rate Limit

100 requests per minute per IP address (max 50 markets per request)

Example Request

curl -X POST "https://app.kash.bot/api/twitter-links" \
  -H "Content-Type: application/json" \
  -d '{
    "markets": [
      { "marketId": "abc123", "side": "yes", "amount": 25 },
      { "marketId": "def456", "side": "no", "amount": 50 }
    ]
  }'

Example Response

200 - Success
{
  "links": [
    {
      "marketId": "abc123",
      "question": "Will BTC hit $100k?",
      "sourceTweetUrl": "https://twitter.com/...",
      "twitterUrl": "https://twitter.com/intent/tweet?text=...",
      "tweetContent": "@kash_bot $25 on Yes https://twitter.com/...",
      "side": "yes",
      "amount": 25
    }
  ],
  "errors": [
    {
      "marketId": "def456",
      "error": "Market not found"
    }
  ],
  "_meta": {
    "requestedAt": "2025-01-15T12:00:00Z",
    "totalRequested": 2,
    "totalGenerated": 1,
    "totalErrors": 1
  }
}

Dynamic Market Discovery

Since markets can expire after 24 hours, use discovery endpoints to always show active markets:
async function loadTrendingPredictions() {
  // 1. Get trending markets
  const marketsRes = await fetch('https://app.kash.bot/api/markets/trending?limit=5');
  const { markets } = await marketsRes.json();

  // 2. Generate Twitter links for each market
  const linksRes = await fetch('https://app.kash.bot/api/twitter-links', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      markets: markets.map(m => ({
        marketId: m.id,
        side: 'yes',
        amount: 25
      }))
    })
  });

  const { links } = await linksRes.json();
  
  // 3. Render your custom UI with the links
  renderMarkets(markets, links);
}

// Refresh every hour to get fresh markets
setInterval(loadTrendingPredictions, 60 * 60 * 1000);
loadTrendingPredictions();