API Documentation - joinruach/JoinRuach GitHub Wiki
The Ruach Studios API provides programmatic access to content, user data, and platform features. Built with tRPC for end-to-end type safety and Next.js API routes for RESTful endpoints.
Base URL: https://api.ruachstudios.com
All API requests require authentication using JWT tokens.
- Create an account at ruachstudios.com
- Navigate to Settings → API Keys
- Generate a new API key
- Store it securely (never commit to version control)
Authorization: Bearer YOUR_API_KEY_HEREInstall the tRPC client:
npm install @trpc/client @trpc/serverInitialize the client:
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '@/server/routers/_app';
const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'https://api.ruachstudios.com/trpc',
headers() {
return {
authorization: `Bearer ${process.env.API_KEY}`,
};
},
}),
],
});Fetch content by ID.
const content = await client.content.getById.query({ id: '123' });
console.log(content);
// Output: { id: '123', title: 'Sample Content', body: '...' }Parameters:
-
id(string, required) — Content ID
Response:
{
id: string;
title: string;
body: string;
createdAt: Date;
updatedAt: Date;
author: {
id: string;
name: string;
};
}Fetch a paginated list of content.
const contentList = await client.content.list.query({
page: 1,
limit: 10,
});
console.log(contentList);
// Output: { items: [...], total: 100, page: 1, limit: 10 }Parameters:
-
page(number, optional) — Page number (default: 1) -
limit(number, optional) — Items per page (default: 10, max: 100)
Response:
{
items: Content[];
total: number;
page: number;
limit: number;
}Create new content.
const newContent = await client.content.create.mutate({
title: 'My New Post',
body: 'Content goes here...',
});
console.log(newContent);
// Output: { id: '456', title: 'My New Post', ... }Parameters:
-
title(string, required) — Content title -
body(string, required) — Content body
Response:
{
id: string;
title: string;
body: string;
createdAt: Date;
}Update existing content.
const updatedContent = await client.content.update.mutate({
id: '123',
title: 'Updated Title',
});
console.log(updatedContent);
// Output: { id: '123', title: 'Updated Title', ... }Parameters:
-
id(string, required) — Content ID -
title(string, optional) — New title -
body(string, optional) — New body
Response:
{
id: string;
title: string;
body: string;
updatedAt: Date;
}Delete content by ID.
await client.content.delete.mutate({ id: '123' });
console.log('Content deleted');Parameters:
-
id(string, required) — Content ID
Response:
{
success: boolean;
}For non-TypeScript environments, use the REST API.
GET /api/content/:idExample:
curl -X GET https://api.ruachstudios.com/api/content/123 \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"id": "123",
"title": "Sample Content",
"body": "...",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}GET /api/content?page=1&limit=10Example:
curl -X GET "https://api.ruachstudios.com/api/content?page=1&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"items": [...],
"total": 100,
"page": 1,
"limit": 10
}POST /api/contentExample:
curl -X POST https://api.ruachstudios.com/api/content \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "My New Post", "body": "Content here..."}'Response:
{
"id": "456",
"title": "My New Post",
"body": "Content here...",
"createdAt": "2024-01-01T00:00:00Z"
}PUT /api/content/:idExample:
curl -X PUT https://api.ruachstudios.com/api/content/123 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Updated Title"}'Response:
{
"id": "123",
"title": "Updated Title",
"body": "...",
"updatedAt": "2024-01-01T12:00:00Z"
}DELETE /api/content/:idExample:
curl -X DELETE https://api.ruachstudios.com/api/content/123 \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"success": true
}Standard Plan:
- 1,000 requests per hour
- 10,000 requests per day
Pro Plan (Future):
- 10,000 requests per hour
- 100,000 requests per day
Exceeding Limits:
{
"error": "Rate limit exceeded",
"retryAfter": 3600
}{
"error": {
"code": "NOT_FOUND",
"message": "Content not found",
"statusCode": 404
}
}| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED |
401 | Invalid or missing API key |
FORBIDDEN |
403 | Insufficient permissions |
NOT_FOUND |
404 | Resource does not exist |
BAD_REQUEST |
400 | Invalid request parameters |
INTERNAL_SERVER_ERROR |
500 | Server error |
RATE_LIMIT_EXCEEDED |
429 | Too many requests |
Subscribe to events:
content.createdcontent.updatedcontent.deleted
npm install @ruachstudios/sdkpip install ruachstudiosgo get github.com/ruachstudios/sdk-goNeed help with the API?
- GitHub Discussions: API Topics
- Email: [email protected]
"Trust in the Lord with all your heart, and do not lean on your own understanding." — Proverbs 3:5