{
  "openapi": "3.1.0",
  "info": { "title": "DailySync API", "version": "1.0.0", "description": "Read and write the authenticated user's DailySync standup notes." },
  "servers": [{ "url": "https://dailysync.apercallc.com/api" }],
  "security": [{ "bearerAuth": [] }],
  "paths": {
    "/me": { "get": { "operationId": "getCurrentUser", "summary": "Verify the API key and get its user", "responses": { "200": { "description": "Authenticated user" }, "401": { "$ref": "#/components/responses/Unauthorized" } } } },
    "/notes": { "get": { "operationId": "listNotes", "summary": "List daily notes", "description": "Returns notes newest first. Follow nextBefore while hasMore is true.", "parameters": [{ "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 500, "default": 250 } }, { "name": "before", "in": "query", "schema": { "type": "string", "format": "date" } }, { "name": "since", "in": "query", "schema": { "type": "string", "format": "date-time" } }], "responses": { "200": { "description": "A page of notes", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotePage" } } } }, "401": { "$ref": "#/components/responses/Unauthorized" } } } },
    "/notes/{date}": {
      "parameters": [{ "name": "date", "in": "path", "required": true, "schema": { "type": "string", "format": "date" } }],
      "put": { "operationId": "saveNote", "summary": "Create or update a note", "description": "Send baseRevision for safe updates. HTTP 409 includes the current server note.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NoteInput" } } } }, "responses": { "200": { "description": "Saved note" }, "400": { "description": "Invalid note" }, "401": { "$ref": "#/components/responses/Unauthorized" }, "409": { "description": "Revision conflict" } } },
      "delete": { "operationId": "deleteNote", "summary": "Delete a note", "responses": { "200": { "description": "Deleted note tombstone" }, "401": { "$ref": "#/components/responses/Unauthorized" }, "404": { "description": "Note not found" } } }
    }
  },
  "components": {
    "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "ds_live_ API key" } },
    "responses": { "Unauthorized": { "description": "Missing, invalid, expired, or revoked API key" } },
    "schemas": {
      "ChecklistItem": { "type": "object", "required": ["text"], "properties": { "id": { "type": "string" }, "text": { "type": "string" }, "completed": { "type": "boolean" }, "category": { "type": "string" }, "severity": { "type": "string" } } },
      "NoteInput": { "type": "object", "properties": { "yesterday": { "type": "string", "maxLength": 50000 }, "today": { "type": "string", "maxLength": 50000 }, "impediments": { "type": "array", "maxItems": 250, "items": { "oneOf": [{ "type": "string" }, { "$ref": "#/components/schemas/ChecklistItem" }] } }, "actionItems": { "type": "array", "maxItems": 250, "items": { "oneOf": [{ "type": "string" }, { "$ref": "#/components/schemas/ChecklistItem" }] } }, "todayPriority": { "type": "string", "default": "normal" }, "baseRevision": { "type": "integer", "minimum": 0 } } },
      "Note": { "allOf": [{ "$ref": "#/components/schemas/NoteInput" }, { "type": "object", "required": ["id", "date", "revision", "updatedAt"], "properties": { "id": { "type": "string" }, "date": { "type": "string", "format": "date" }, "revision": { "type": "integer" }, "deletedAt": { "type": ["string", "null"], "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } }] },
      "NotePage": { "type": "object", "properties": { "notes": { "type": "array", "items": { "$ref": "#/components/schemas/Note" } }, "cursor": { "type": "string", "format": "date-time" }, "hasMore": { "type": "boolean" }, "nextBefore": { "type": ["string", "null"], "format": "date" } } }
    }
  }
}
