Skip to main content

Overview

Raily integrates seamlessly with your existing infrastructure. Whether you’re connecting to AI providers, syncing with your CMS, or building custom integrations, we’ve got you covered.

Integration Methods

Raily supports multiple integration patterns:

Direct API Integration

The most flexible approach. Use our REST API directly in your application.
import Raily from '@raily/sdk';

const raily = new Raily({ apiKey: process.env.RAILY_API_KEY });

// Register content
await raily.content.create({ ... });

// Check access
const access = await raily.access.check({ ... });

SDK Libraries

Native libraries for popular languages:
LanguagePackageInstallation
JavaScript/TypeScript@raily/sdknpm install @raily/sdk
Pythonrailypip install raily

Webhooks

Receive real-time notifications when events occur:
// Your webhook endpoint receives events like:
{
  type: "access.granted",
  timestamp: "2024-01-15T10:30:00Z",
  data: {
    contentId: "cnt_abc123",
    requesterId: "partner_openai",
    permissions: ["full_access"]
  }
}

CMS Plugins

Pre-built plugins for popular content management systems:
  • WordPress: One-click plugin from the WordPress directory
  • Contentful: Native app from the Contentful marketplace
  • Strapi: Community plugin with lifecycle hooks

Quick Start Examples

Protect your content when used with OpenAI’s API:
import OpenAI from 'openai';
import Raily from '@raily/sdk';

const openai = new OpenAI();
const raily = new Raily({ apiKey: process.env.RAILY_API_KEY });

async function queryWithProtectedContent(userQuery, contentId) {
  // Check access first
  const access = await raily.access.check({
    contentId,
    requesterId: "my_app",
    context: { purpose: "rag" }
  });

  if (!access.allowed) {
    throw new Error(`Access denied: ${access.reason}`);
  }

  // Fetch protected content
  const contentResponse = await fetch(access.contentUrl, {
    headers: { Authorization: `Bearer ${access.token}` }
  });
  const content = await contentResponse.text();

  // Use with OpenAI
  const response = await openai.chat.completions.create({
    model: "gpt-4",
    messages: [
      { role: "system", content: `Context: ${content}` },
      { role: "user", content: userQuery }
    ]
  });

  return response.choices[0].message.content;
}

Authentication

All integrations use API key authentication:
# Header-based authentication
Authorization: Bearer raily_sk_xxxxxxxxxxxx
Generate API keys from your dashboard.
Security Best Practices
  • Use environment variables for API keys
  • Never commit keys to version control
  • Use different keys for development and production
  • Rotate keys periodically

Rate Limits

Integration rate limits by plan:
PlanRequests/minuteRequests/day
Starter6010,000
Professional300100,000
EnterpriseCustomCustom
Rate limit headers are included in every response:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 295
X-RateLimit-Reset: 1705320000

Error Handling

All integrations return consistent error responses:
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Please retry after 60 seconds.",
    "retryAfter": 60
  }
}
Common error codes:
CodeDescription
invalid_api_keyAPI key is missing or invalid
rate_limit_exceededToo many requests
content_not_foundContent ID doesn’t exist
access_deniedPolicy blocked the request
server_errorInternal server error

Next Steps