SageOx Repositories API
The Repositories API from SageOx — 6 operation(s) for repositories.
The Repositories API from SageOx — 6 operation(s) for repositories.
openapi: 3.1.0
info:
title: SageOx Admin Repositories API
version: 1.0.0
description: "# API Reference\n\n## Overview\n\nSageOx is a platform that captures team knowledge from discussions, decisions, and work context into a Ledger (per-repo historical record) and Team Context (team-wide shared knowledge). The SageOx API provides programmatic access to manage repositories, recordings, notifications, and team data with high performance and reliability.\n\n## Base URLs\n\n| Environment | URL |\n|---|---|\n| Local Development | `http://localhost:3000` |\n| Test | `https://test.sageox.ai` |\n| Production | `https://sageox.ai` |\n\n## Authentication\n\nAll requests to the SageOx API require authentication via JWT tokens issued by the Better Auth service.\n\nInclude your token in the `Authorization` header:\n```\nAuthorization: Bearer <token>\n```\n\n**Initial Auth Flow (CLI)**\n- CLI initiates device flow to obtain initial credentials\n- Exchange device code for JWT token\n- Store token securely for subsequent API requests\n- Refresh token when expired\n\n**Authenticated Endpoints**\n- Pass JWT in `Authorization: Bearer <token>` header\n- Tokens contain user identity and team membership\n- Invalid or expired tokens return 401 Unauthorized\n\n## Response Format\n\n### Success\nStandard response format with optional pagination metadata:\n```json\n{\n \"success\": true,\n \"data\": { ... }\n}\n```\n\n### Error\nAll errors follow a consistent format:\n```json\n{\n \"success\": false,\n \"error\": \"Human-readable error description\"\n}\n```\n\n**Status Codes**\n- `400` — Bad Request: Invalid parameters or malformed request\n- `401` — Unauthorized: Missing or invalid authentication token\n- `403` — Forbidden: Insufficient permissions for this resource\n- `404` — Not Found: Resource does not exist\n- `409` — Conflict: Request conflicts with current state (e.g., duplicate)\n- `429` — Rate Limited: Too many requests; retry with backoff\n- `500` — Internal Error: Server error; contact support if persistent\n\n## Pagination\n\nList endpoints support cursor-based pagination via query parameters:\n\n**Query Parameters**\n- `limit` — Number of results per page (default: 20, max: 100)\n- `offset` — Number of results to skip (default: 0)\n\n**Response Metadata**\nList responses include pagination info:\n```json\n{\n \"success\": true,\n \"data\": [ ... ],\n \"meta\": {\n \"total\": 150,\n \"limit\": 20,\n \"offset\": 0,\n \"hasMore\": true\n }\n}\n```\n\n## ID Formats\n\nResources use standardized ID formats for easy identification:\n\n| Resource | Format | Length | Example |\n|---|---|---|---|\n| Team | `team_<cuid2>` | 10 chars | `team_abc1234567` |\n| User | `usr_<cuid2>` | 10 chars | `usr_xyz9876543` |\n| Repository | `repo_<uuidv7>` | 36 chars | `repo_01934f5a-8b9c-7def-abcd-0123456789ab` |\n| Recording | `rec_<uuidv7>` | 36 chars | `rec_01934f5a-8b9c-7def-abcd-0123456789ab` |\n| Image | `img_<uuidv7>` | 36 chars | `img_01934f5a-8b9c-7def-abcd-0123456789ab` |\n| Notification | `notif_<cuid2>` | 14 chars | `notif_ab1cd2ef3g` |\n\nUse these IDs for all API operations. IDs are unique across environments.\n\n## Rate Limiting\n\nThe API applies rate limiting to protect against abuse and ensure fair access:\n\n**Authenticated Endpoints**\n- Limited per user: depends on subscription tier\n- Quota resets hourly\n\n**Unauthenticated Endpoints**\n- Limited per IP address\n- More restrictive than authenticated limits\n\nWhen rate limited, the API returns `429 Too Many Requests`. Retry requests with exponential backoff:\n```\nwait = min(2^attempt * 100ms, 10s)\n```\n\n## Timestamps\n\nAll timestamps in API responses use RFC 3339 / ISO 8601 format in UTC:\n```\n2025-12-03T10:30:00Z\n```\n\nUse this format when providing timestamps in requests as well. The API rejects timestamps in other formats.\n\n## SDKs & Tools\n\n- **OpenAPI Spec** — Full schema available at `/api/openapi.json`\n- **Postman Collection** — Import from `/api/postman.json` for interactive exploration\n- **CLI** — Use `ox` CLI for command-line access\n"
contact:
name: SageOx Team
license:
name: MIT
servers:
- url: http://localhost:3000
description: Devcontainer
- url: https://test.sageox.ai
description: Test
- url: https://sageox.ai
description: Production
security:
- bearerAuth: []
tags:
- name: Repositories
paths:
/api/v1/repos/{repo_id}/uninstall:
post:
operationId: initiateUninstall
summary: Initiate repository uninstall
description: 'Initiates an uninstall request for a repository, removing cloud resources while preserving data.
**Authentication:** Required (bearer token)
**Access Control:** User must be a team admin or owner.
**Workflow:** Triggers a Temporal workflow that handles confirmation and cleanup.
**Status:** Returns 202 Accepted - the workflow handles the rest asynchronously.
**Confirmation:** User must confirm uninstall via POST /api/v1/repos/{repo_id}/uninstall/confirm
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
requestBody:
content:
application/json:
schema:
type: object
properties:
reason:
type: string
example: Project archived
description: Optional reason for audit purposes
responses:
'202':
description: Uninstall request accepted - workflow in progress
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
- status_url
- expires_at
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
example: pending
status_url:
type: string
format: uri
example: https://web.example.com/repos/repo_01934f5a-8b9c-7def-b012-3456789abcde/uninstall
expires_at:
type: string
format: date-time
example: '2025-12-25T10:30:00Z'
workflow_id:
type: string
example: uninstall-requested-repo_01934f5a-8b9c-7def-b012-3456789abcde
'400':
description: Invalid repo_id or request body
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a team admin or owner
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Uninstall already pending
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
get:
operationId: getUninstallStatus
summary: Get uninstall request status
description: 'Returns the current status of an uninstall request.
**Authentication:** Required (bearer token)
**Access Control:** User must be a member of the team associated with the repository.
**Status Values:**
- `pending` - Awaiting confirmation (includes confirmation_required field)
- `confirmed` - Confirmed, cleanup in progress
- `canceled` - Request was canceled
- `expired` - Confirmation window expired
- `completed` - Uninstall completed
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
responses:
'200':
description: Uninstall status retrieved
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
- initiated_by
- initiated_at
- expires_at
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
enum:
- pending
- confirmed
- canceled
- expired
- completed
example: pending
initiated_by:
type: string
example: user_2n3k4m5l6j7h8g9f
initiated_at:
type: string
format: date-time
example: '2025-12-18T10:30:00Z'
expires_at:
type: string
format: date-time
example: '2025-12-25T10:30:00Z'
confirmed_by:
type: string
nullable: true
example: user_2n3k4m5l6j7h8g9f
confirmed_at:
type: string
nullable: true
format: date-time
example: '2025-12-18T11:00:00Z'
confirmation_required:
type: string
description: Text that must be typed to confirm (only when status is pending)
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
workflow_id:
type: string
example: uninstall-requested-repo_01934f5a-8b9c-7def-b012-3456789abcde
'400':
description: Invalid repo_id format
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a member of the associated team
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository or uninstall request not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/v1/repos/{repo_id}/uninstall/confirm:
post:
operationId: confirmUninstall
summary: Confirm uninstall request
description: 'Confirms an uninstall request. User must type the repo ID to confirm.
**Authentication:** Required (bearer token)
**Access Control:** User must be a team admin or owner.
**Confirmation:** The confirmation_text field must exactly match the repo_id.
**Workflow:** Signals the Temporal workflow to proceed with uninstall.
**Response:** Returns 202 Accepted - the workflow handles cleanup asynchronously.
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- confirmation_text
properties:
confirmation_text:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Must exactly match the repo_id
responses:
'202':
description: Confirmation signal sent - workflow proceeding
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
example: confirming
initiated_by:
type: string
example: user_2n3k4m5l6j7h8g9f
initiated_at:
type: string
format: date-time
example: '2025-12-18T10:30:00Z'
expires_at:
type: string
format: date-time
example: '2025-12-25T10:30:00Z'
'400':
description: Invalid repo_id or confirmation_text does not match
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a team admin or owner
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository or uninstall request not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Uninstall request not pending or has expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/v1/repos/{repo_id}/uninstall/cancel:
post:
operationId: cancelUninstall
summary: Cancel uninstall request
description: 'Cancels a pending uninstall request.
**Authentication:** Required (bearer token)
**Access Control:** User must be a team admin or owner.
**Workflow:** Signals the Temporal workflow to cancel the uninstall.
**Response:** Returns 202 Accepted - the workflow handles state update asynchronously.
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
responses:
'202':
description: Cancellation signal sent - workflow updating state
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
example: canceling
initiated_by:
type: string
example: user_2n3k4m5l6j7h8g9f
initiated_at:
type: string
format: date-time
example: '2025-12-18T10:30:00Z'
'400':
description: Invalid repo_id format
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a team admin or owner
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository or uninstall request not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Uninstall request not pending or has expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/v1/repos/{repo_id}/delete:
post:
operationId: initiateDeletion
summary: Initiate repository deletion
description: 'Initiates a deletion request for a repository, permanently removing all data.
**Authentication:** Required (bearer token)
**Access Control:** User must be a team admin or owner.
**Workflow:** Triggers a Temporal workflow that handles confirmation and cleanup.
**Status:** Returns 202 Accepted - the workflow handles the rest asynchronously.
**Confirmation:** User must confirm deletion via POST /api/v1/repos/{repo_id}/delete/confirm
**Warning:** This operation is irreversible.
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
requestBody:
content:
application/json:
schema:
type: object
properties:
reason:
type: string
example: No longer needed
description: Optional reason for audit purposes
responses:
'202':
description: Deletion request accepted - workflow in progress
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
- status_url
- expires_at
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
example: pending
status_url:
type: string
format: uri
example: https://web.example.com/repos/repo_01934f5a-8b9c-7def-b012-3456789abcde/delete
expires_at:
type: string
format: date-time
example: '2025-12-25T10:30:00Z'
workflow_id:
type: string
example: deletion-requested-repo-repo_01934f5a-8b9c-7def-b012-3456789abcde
'400':
description: Invalid repo_id or request body
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a team admin or owner
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Deletion already pending
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
get:
operationId: getDeletionStatus
summary: Get deletion request status
description: 'Returns the current status of a deletion request.
**Authentication:** Required (bearer token)
**Access Control:** User must be a member of the team associated with the repository.
**Status Values:**
- `pending` - Awaiting confirmation
- `confirmed` - Confirmed, deletion in progress
- `canceled` - Request was canceled
- `expired` - Confirmation window expired
- `completed` - Deletion completed
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
responses:
'200':
description: Deletion status retrieved
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
- initiated_by
- initiated_at
- expires_at
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
enum:
- pending
- confirmed
- canceled
- expired
- completed
example: pending
initiated_by:
type: string
example: user_2n3k4m5l6j7h8g9f
initiated_at:
type: string
format: date-time
example: '2025-12-18T10:30:00Z'
expires_at:
type: string
format: date-time
example: '2025-12-25T10:30:00Z'
confirmed_by:
type: string
nullable: true
example: user_2n3k4m5l6j7h8g9f
confirmed_at:
type: string
nullable: true
format: date-time
example: '2025-12-18T11:00:00Z'
canceled_by:
type: string
nullable: true
example: user_2n3k4m5l6j7h8g9f
canceled_at:
type: string
nullable: true
format: date-time
example: '2025-12-18T11:05:00Z'
workflow_id:
type: string
example: deletion-requested-repo-repo_01934f5a-8b9c-7def-b012-3456789abcde
'400':
description: Invalid repo_id format
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a member of the associated team
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository or deletion request not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/v1/repos/{repo_id}/delete/confirm:
post:
operationId: confirmDeletion
summary: Confirm deletion request
description: 'Confirms a deletion request. Permanently deletes the repository and all associated data.
**Authentication:** Required (bearer token)
**Access Control:** User must be a team admin or owner.
**Workflow:** Signals the Temporal workflow to proceed with deletion.
**Response:** Returns 202 Accepted - the workflow handles cleanup asynchronously.
**Warning:** This operation is irreversible.
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
responses:
'202':
description: Confirmation signal sent - deletion proceeding
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
example: confirming
initiated_by:
type: string
example: user_2n3k4m5l6j7h8g9f
initiated_at:
type: string
format: date-time
example: '2025-12-18T10:30:00Z'
expires_at:
type: string
format: date-time
example: '2025-12-25T10:30:00Z'
'400':
description: Invalid repo_id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a team admin or owner
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository or deletion request not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Deletion request not pending or has expired
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/v1/repos/{repo_id}/delete/cancel:
post:
operationId: cancelDeletion
summary: Cancel deletion request
description: 'Cancels a pending deletion request.
**Authentication:** Required (bearer token)
**Access Control:** User must be a team admin or owner.
**Workflow:** Signals the Temporal workflow to cancel the deletion.
**Response:** Returns 202 Accepted - the workflow handles state update asynchronously.
'
tags:
- Repositories
security:
- bearerAuth: []
parameters:
- name: repo_id
in: path
required: true
schema:
type: string
pattern: ^repo_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
description: Repository identifier
responses:
'202':
description: Cancellation signal sent - workflow updating state
content:
application/json:
schema:
type: object
required:
- repo_id
- team_id
- status
properties:
repo_id:
type: string
example: repo_01934f5a-8b9c-7def-b012-3456789abcde
team_id:
type: string
example: team_abc123xyz
status:
type: string
example: canceling
initiated_by:
type: string
example: user_2n3k4m5l6j7h8g9f
initiated_at:
type: string
format: date-time
example: '2025-12-18T10:30:00Z'
'400':
description: Invalid repo_id format
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Not a team admin or owner
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Repository or deletion request not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorRespon
# --- truncated at 32 KB (33 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/sageox/refs/heads/main/openapi/sageox-repositories-api-openapi.yml