Idiomark - API Reference
Complete API documentation for all Idiomark services.
Table of Contents
Storage API
Cloud storage endpoints for Idiomark files.
Base URL
https://api.idiomark.protocol/storage
Authentication
All requests require an API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Endpoints
List Files
GET /api/storage/files
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 100 | Maximum number of files to return |
| offset | integer | 0 | Number of files to skip |
| sortBy | string | created | Sort field (created, updated, name) |
| order | string | desc | Sort order (asc, desc) |
Response:
{
"files": [
{
"idiomark": "1.0.0",
"id": "uuid-v4",
"created": "2024-01-01T00:00:00Z",
"updated": "2024-01-01T00:00:00Z",
"metadata": { ... },
"personality": { ... }
}
],
"total": 100,
"limit": 100,
"offset": 0
}
Get File
GET /api/storage/files/:id
Response:
{
"idiomark": "1.0.0",
"id": "uuid-v4",
"created": "2024-01-01T00:00:00Z",
"updated": "2024-01-01T00:00:00Z",
"metadata": { ... },
"personality": { ... },
"signature": "..."
}
Create File
POST /api/storage/files
Request Body:
{
"idiomark": "1.0.0",
"id": "uuid-v4",
"created": "2024-01-01T00:00:00Z",
"updated": "2024-01-01T00:00:00Z",
"metadata": { ... },
"personality": { ... }
}
Response:
{
"id": "uuid-v4",
"version": "1",
"etag": "abc123...",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
Update File
PUT /api/storage/files/:id
Request Body: Same as Create File
Response: Same as Create File
Delete File
DELETE /api/storage/files/:id
Response:
{
"success": true
}
Check Existence
HEAD /api/storage/files/:id
Response:
200 OK- File exists404 Not Found- File does not exist
Trigger Sync
POST /api/storage/sync
Request Body:
{
"fileId": "uuid-v4"
}
Response:
{
"success": true,
"syncedAt": "2024-01-01T00:00:00Z"
}
Health Check
GET /api/storage/health
Response:
{
"status": "healthy",
"timestamp": "2024-01-01T00:00:00Z",
"storage": {
"type": "s3",
"bucket": "idiomark-files",
"region": "us-east-1"
}
}
Sync WebSocket API
Real-time synchronization using WebSockets.
Server URL
wss://api.idiomark.protocol/sync
Authentication
Connect with token in URL or as first message:
wss://api.idiomark.protocol/sync?token=YOUR_TOKEN
Client → Server Messages
Subscribe
{
"type": "subscribe",
"channel": "idiomark:file-id",
"timestamp": 1234567890
}
Unsubscribe
{
"type": "unsubscribe",
"channel": "idiomark:file-id",
"timestamp": 1234567890
}
Request Sync (Pull)
{
"type": "sync:pull",
"since": 1234567890,
"timestamp": 1234567890
}
Update Presence
{
"type": "presence:update",
"status": "online",
"data": {
"typing": true
},
"timestamp": 1234567890
}
Ping
{
"type": "ping",
"timestamp": 1234567890
}
Server → Client Messages
File Created
{
"type": "file:created",
"fileId": "uuid-v4",
"file": { /* IdiomarkFile */ },
"timestamp": 1234567890
}
File Updated
{
"type": "file:updated",
"fileId": "uuid-v4",
"file": { /* IdiomarkFile */ },
"timestamp": 1234567890
}
File Deleted
{
"type": "file:deleted",
"fileId": "uuid-v4",
"timestamp": 1234567890
}
Sync Started
{
"type": "sync:started",
"files": 5,
"timestamp": 1234567890
}
Sync Completed
{
"type": "sync:completed",
"files": 5,
"errors": 0,
"timestamp": 1234567890
}
Sync Conflict
{
"type": "sync:conflict",
"fileId": "uuid-v4",
"localVersion": "2",
"remoteVersion": "3",
"timestamp": 1234567890
}
Presence Online
{
"type": "presence:online",
"userId": "user-id",
"device": "browser",
"timestamp": 1234567890
}
Presence Offline
{
"type": "presence:offline",
"userId": "user-id",
"timestamp": 1234567890
}
Presence Typing
{
"type": "presence:typing",
"userId": "user-id",
"isTyping": true,
"timestamp": 1234567890
}
Pong
{
"type": "pong",
"timestamp": 1234567890
}
Error
{
"type": "error",
"message": "Error description",
"code": 4000,
"timestamp": 1234567890
}
Channels
| Pattern | Description | Example |
|---|---|---|
idiomark:{fileId} | Updates for specific file | idiomark:abc-123-def |
user:{userId} | All user's files | user:user-123 |
presence:{userId} | User presence | presence:user-123 |
Identity API
Identity verification with zero-knowledge proofs.
Base URL
https://api.idiomark.protocol/identity
Endpoints
Generate Key Pair
POST /api/identity/generate
Request Body:
{
"type": "ed25519"
}
Response:
{
"did": "did:idiomark:abc123...",
"publicKey": "base64-public-key",
"keyId": "abc123",
"keyType": "ed25519",
"createdAt": "2024-01-01T00:00:00Z"
}
Issue Claim
POST /api/identity/issue
Request Body:
{
"subject": "did:idiomark:user-id",
"type": "platform:ownership",
"data": {
"platform": "twitter",
"username": "@user",
"userId": "123456",
"profileUrl": "https://twitter.com/user"
},
"expiresAt": "2024-12-31T23:59:59Z"
}
Response:
{
"claim": { /* IdentityClaim */ },
"id": "claim-id",
"type": "platform:ownership",
"subject": "did:idiomark:user-id",
"issuer": "did:idiomark:issuer-id",
"issuedAt": "2024-01-01T00:00:00Z",
"expiresAt": "2024-12-31T23:59:59Z"
}
Revoke Claim
DELETE /api/identity/claims/:id
Request Body:
{
"reason": "No longer valid"
}
Response:
{
"success": true,
"claim": { /* revoked claim */ }
}
Get Claims
GET /api/identity/claims?subject=:subject
Response:
{
"subject": "did:idiomark:user-id",
"claims": [ /* IdentityClaim[] */ ],
"count": 5
}
Verify Claim
POST /api/identity/verify
Request Body:
{
"claimId": "claim-id"
}
Response:
{
"claimId": "claim-id",
"valid": true,
"trustLevel": "high",
"verifiedAt": "2024-01-01T00:00:00Z",
"verifier": "idiomark-identity-verifier",
"metadata": {
"checks": ["revocation_check", "proof_verification", ...],
"proofValid": true,
"signatureValid": true,
"notExpired": true,
"notRevoked": true
}
}
Get Trust Score
GET /api/identity/trust/:subject
Response:
{
"subject": "did:idiomark:user-id",
"score": 85,
"level": "high",
"breakdown": {
"platformScore": 80,
"ageScore": 60,
"claimScore": 40,
"proofScore": 90,
"peerScore": 50
},
"calculatedAt": "2024-01-01T00:00:00Z"
}
Generate ZK Proof
POST /api/identity/prove
Request Body:
{
"type": "ownership",
"publicInputs": {
"username": "@user"
},
"privateInputs": {
"privateKey": "..."
},
"verifier": "did:idiomark:verifier-id"
}
Response:
{
"proof": { /* ZeroKnowledgeProof */ },
"type": "ownership",
"timestamp": "2024-01-01T00:00:00Z"
}
Teams API
Team collaboration and access control.
Base URL
https://api.idiomark.protocol/teams
Endpoints
List Teams
GET /api/teams
Response:
{
"teams": [ /* Team[] */ ],
"count": 5
}
Create Team
POST /api/teams
Request Body:
{
"name": "My Team",
"description": "Team for AI personalities",
"slug": "my-team",
"tier": "pro"
}
Response: Team object
Get Team
GET /api/teams/:slug
Response: Team object
Update Team
PUT /api/teams/:slug
Request Body:
{
"name": "Updated Team Name",
"description": "New description"
}
Response: Updated Team object
Delete Team
DELETE /api/teams/:slug
Response:
{
"success": true
}
List Members
GET /api/teams/:slug/members
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Filter by status (active, pending, etc.) |
| roleId | string | Filter by role |
| limit | integer | Max results |
| offset | integer | Offset for pagination |
Response:
{
"members": [ /* TeamMember[] */ ],
"count": 10
}
Add Member
POST /api/teams/:slug/members
Request Body:
{
"userId": "user-id",
"roles": ["member"],
"email": "user@example.com",
"displayName": "User Name"
}
Response: TeamMember object
Remove Member
DELETE /api/teams/:slug/members/:memberId
Response:
{
"success": true
}
Update Member Roles
PUT /api/teams/:slug/members/:memberId/roles
Request Body:
{
"roles": ["admin", "member"]
}
Response: Updated TeamMember object
List Resources
GET /api/teams/:slug/resources
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
| type | string | Filter by resource type |
| scope | string | Filter by scope |
| limit | integer | Max results |
| offset | integer | Offset for pagination |
Response:
{
"resources": [ /* SharedResource[] */ ],
"count": 25
}
Share Resource
POST /api/teams/:slug/resources
Request Body:
{
"type": "idiomark:files",
"resourceId": "file-id",
"name": "My Personality",
"scope": "roles",
"allowedRoles": ["admin", "member"],
"description": "Shared personality"
}
Response: SharedResource object
Unshare Resource
DELETE /api/teams/:slug/resources/:resourceId
Response:
{
"success": true
}
List Invitations
GET /api/teams/:slug/invitations
Response:
{
"invitations": [ /* Invitation[] */ ],
"count": 3
}
Create Invitation
POST /api/teams/:slug/invitations
Request Body:
{
"email": "user@example.com",
"roles": ["member"],
"message": "Join our team!",
"expiresInSeconds": 604800
}
Response: Invitation object with token
Accept Invitation
POST /api/invitations/:token/accept
Response:
{
"team": {
"id": "team-id",
"name": "Team Name",
"slug": "team-slug"
},
"member": { /* TeamMember */ }
}
Decline Invitation
POST /api/invitations/:token/decline
Response:
{
"success": true
}
Revoke Invitation
DELETE /api/teams/:slug/invitations/:invitationId
Response:
{
"success": true
}
Check Permission
POST /api/teams/:slug/permissions/check
Request Body:
{
"userId": "user-id",
"resource": "idiomark:files",
"action": "read",
"resourceId": "file-id"
}
Response:
{
"result": "allowed",
"matchedPermissions": [ /* Permission[] */ ],
"userRoles": ["member"],
"error": null
}
Inference API
Generate personality-powered responses.
Base URL
https://api.idiomark.protocol/inference
Endpoints
Generate Response
POST /api/inference/generate
Request Body:
{
"message": "Hello! How are you today?",
"personalityId": "file-id",
"context": [
{
"role": "user",
"content": "Hi there!",
"timestamp": 1234567890
}
],
"options": {
"temperature": 0.7,
"maxTokens": 500
}
}
Response:
{
"response": "Hello! I'm doing well, thanks for asking!",
"personalityId": "file-id",
"model": "claude-3-opus",
"tokensUsed": 45,
"timestamp": "2024-01-01T00:00:00Z"
}
Stream Response
POST /api/inference/stream
Request Body: Same as Generate Response
Response: Server-Sent Events (SSE) stream
data: {"delta": "Hello", "done": false, "personalityId": "file-id"}
data: {"delta": "!", "done": false, "personalityId": "file-id"}
data: {"delta": "", "done": true, "personalityId": "file-id"}
Error Codes
| Code | Description |
|---|---|
| 4000 | Invalid request |
| 4001 | Authentication failed |
| 4002 | Unauthorized |
| 4003 | Rate limited |
| 4004 | Not found |
| 4005 | Validation error |
| 5000 | Internal server error |
| 5001 | Service unavailable |
Rate Limits
| Tier | Requests/Minute | Burst |
|---|---|---|
| Free | 60 | 10 |
| Pro | 600 | 100 |
| Enterprise | 6000 | 1000 |
Rate limit headers are included in responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1234567890