Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

16.5 KB
Raw Blame
{
  "openapi": "3.1.0",
  "info": {
    "title": "Sync Service",
    "description": "Document sync service JSON control plane",
    "contact": {
      "name": "Macro"
    },
    "version": "0.1.0"
  },
  "paths": {
    "/document/{document_id}/active_peers": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_active_peers",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_ai",
            "in": "query",
            "description": "Set to `false` or `0` to filter out AI editors",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active peer ids",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          },
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/blame/{node_id}": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_blame",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "node_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlameRow"
                }
              }
            }
          },
          "401": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          },
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/copy": {
      "post": {
        "tags": ["sync_service"],
        "operationId": "copy_document",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "description": "Source document to copy from",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CopyDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Copy succeeded; the new document was initialized"
          },
          "404": {
            "description": "Source snapshot not found"
          }
        }
      }
    },
    "/document/{document_id}/delete": {
      "delete": {
        "tags": ["sync_service"],
        "operationId": "document_delete",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "401": {
            "description": ""
          },
          "403": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/exists": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_exists",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document exists"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/document/{document_id}/initialize": {
      "post": {
        "tags": ["sync_service"],
        "operationId": "document_initialize",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "$ref": "#/components/schemas/BinaryBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Initialized"
          },
          "401": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          },
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/metadata": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_metadata",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMetadata"
                }
              }
            }
          },
          "401": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          },
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/peer/{peer_id}": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_peer",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "peer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeerResponse"
                }
              }
            }
          }
        }
      }
    },
    "/document/{document_id}/raw": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_raw",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Raw document JSON"
          },
          "401": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          },
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/snapshot": {
      "post": {
        "tags": ["sync_service"],
        "operationId": "document_snapshot",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetSnapshotRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Loro snapshot bytes",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "$ref": "#/components/schemas/BinaryBody"
                }
              }
            }
          },
          "400": {
            "description": ""
          },
          "401": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          },
          {
            "internal_key": []
          }
        ]
      }
    },
    "/document/{document_id}/state": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_state",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "shallow",
            "in": "query",
            "description": "Return current state without prior edit history",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SnapshotResponse"
                }
              }
            }
          },
          "401": {
            "description": ""
          },
          "403": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          }
        ]
      }
    },
    "/document/{document_id}/update": {
      "post": {
        "tags": ["sync_service"],
        "operationId": "document_update",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateResponse"
                }
              }
            }
          },
          "400": {
            "description": ""
          },
          "401": {
            "description": ""
          },
          "403": {
            "description": ""
          },
          "404": {
            "description": ""
          },
          "409": {
            "description": ""
          },
          "413": {
            "description": ""
          },
          "500": {
            "description": ""
          },
          "503": {
            "description": ""
          }
        },
        "security": [
          {
            "document_permission": []
          }
        ]
      }
    },
    "/document/{document_id}/wakeup": {
      "get": {
        "tags": ["sync_service"],
        "operationId": "document_wakeup",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Keepalive scheduled"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BinaryBody": {
        "type": "string",
        "format": "binary"
      },
      "BlameRow": {
        "type": "object",
        "required": ["peer_id", "timestamp_ms"],
        "properties": {
          "actor": {
            "type": ["string", "null"],
            "description": "Signed agent actor (`bot|<uuid>`) the peer edited as; null for humans."
          },
          "peer_id": {
            "type": "string"
          },
          "timestamp_ms": {
            "type": "integer",
            "format": "int64"
          },
          "user_id": {
            "type": ["string", "null"]
          }
        }
      },
      "CopyDocumentRequest": {
        "type": "object",
        "required": ["target_document_id"],
        "properties": {
          "target_document_id": {
            "type": "string"
          },
          "version_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/VersionIndicator"
              }
            ]
          }
        }
      },
      "DocumentMetadata": {
        "type": "object",
        "required": ["id", "peers", "version_id"],
        "properties": {
          "id": {
            "type": "string"
          },
          "peers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PeerWithUserId"
            }
          },
          "version_id": {
            "type": "string"
          }
        }
      },
      "GetSnapshotRequest": {
        "type": "object",
        "properties": {
          "version_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/VersionIndicator"
              }
            ]
          }
        }
      },
      "PeerResponse": {
        "type": "object",
        "required": ["peer_id", "user_id"],
        "properties": {
          "peer_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "PeerWithUserId": {
        "type": "object",
        "required": ["peer_id", "user_id"],
        "properties": {
          "actor": {
            "type": ["string", "null"],
            "description": "Signed agent actor (`bot|<uuid>`) the peer edited as; null for humans."
          },
          "peer_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "SnapshotResponse": {
        "type": "object",
        "required": ["snapshot", "revision"],
        "properties": {
          "revision": {
            "type": "string"
          },
          "snapshot": {
            "type": "string"
          }
        }
      },
      "UpdateRequest": {
        "type": "object",
        "required": ["expectedRevision", "update"],
        "properties": {
          "expectedRevision": {
            "type": "string"
          },
          "update": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "UpdateResponse": {
        "type": "object",
        "required": ["revision", "applied"],
        "properties": {
          "applied": {
            "type": "boolean"
          },
          "revision": {
            "type": "string"
          }
        }
      },
      "VersionIndicator": {
        "type": "object",
        "required": ["peer", "counter"],
        "properties": {
          "counter": {
            "type": "integer",
            "format": "int32"
          },
          "peer": {
            "type": "string",
            "description": "Json has trouble with peer id bigints, so we need to serialize from a string"
          }
        }
      }
    },
    "securitySchemes": {
      "document_permission": {
        "type": "http",
        "scheme": "bearer"
      },
      "internal_key": {
        "type": "apiKey",
        "in": "header",
        "name": "x-internal-auth-key"
      }
    }
  },
  "tags": [
    {
      "name": "sync_service",
      "description": "Sync service"
    }
  ]
}