{"openapi":"3.1.0","info":{"title":"MyAtoms Personal Knowledge API","version":"1.0.0","description":"REST API for searching, reading, and saving personal Atoms (notes & highlights) and Sources."},"servers":[{"url":"https://beta.myatoms.io/api/v1","description":"MyAtoms API v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal API Token generated at /settings/api (prefixed with ma_)."}},"schemas":{"Source":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["web","book"]},"title":{"type":"string"},"author":{"type":["string","null"]},"url":{"type":["string","null"]},"isbn":{"type":["string","null"]},"atomCount":{"type":"integer"}},"required":["id","type","title"]},"Atom":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["note","highlight","note_highlight"]},"note":{"type":["string","null"]},"highlight":{"type":["string","null"]},"content":{"type":["string","null"]},"app":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"source":{"anyOf":[{"$ref":"#/components/schemas/Source"},{"type":"null"}]}},"required":["id","type","createdAt"]},"CreateAtomRequest":{"type":"object","properties":{"type":{"type":"string","enum":["note","highlight","note_highlight"],"default":"note"},"note":{"type":"string"},"highlight":{"type":"string"},"content":{"type":"string"},"sourceId":{"type":"string"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["web","book"]},"title":{"type":"string"},"author":{"type":"string"},"url":{"type":"string"},"isbn":{"type":"string"}},"required":["type","title"]},"app":{"type":"string"},"createdAt":{"type":"string","format":"date-time","description":"Optional ISO 8601 creation timestamp. Leave omitted for normal note creation; only specify when asynchronously syncing historical notes from another platform."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}},"paths":{"/atoms":{"get":{"operationId":"searchAtoms","summary":"Search or list recent Atoms","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string","enum":["note","highlight","note_highlight"]}},{"name":"sourceType","in":"query","schema":{"type":"string","enum":["web","book"]}},{"name":"sourceId","in":"query","schema":{"type":"string"}},{"name":"dateFrom","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"dateTo","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":15}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Matching Atoms","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"atoms":{"type":"array","items":{"$ref":"#/components/schemas/Atom"}}}}}}},"401":{"description":"Unauthorized"}}},"post":{"operationId":"createAtom","summary":"Save a new Atom","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAtomRequest"}}}},"responses":{"201":{"description":"Created Atom","content":{"application/json":{"schema":{"type":"object","properties":{"atom":{"$ref":"#/components/schemas/Atom"}}}}}},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"}}}},"/atoms/{id}":{"get":{"operationId":"getAtomById","summary":"Get a single Atom with full text","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Atom details","content":{"application/json":{"schema":{"type":"object","properties":{"atom":{"$ref":"#/components/schemas/Atom"}}}}}},"404":{"description":"Atom not found"}}}},"/sources":{"get":{"operationId":"listSources","summary":"List books and web articles (Sources)","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string","enum":["web","book"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Sources list","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"sources":{"type":"array","items":{"$ref":"#/components/schemas/Source"}}}}}}}}}},"/sources/{id}/atoms":{"get":{"operationId":"getAtomsBySource","summary":"List Atoms belonging to a specific Source","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Source and its Atoms"},"404":{"description":"Source not found"}}}},"/stats":{"get":{"operationId":"getKnowledgeStats","summary":"Get knowledge base summary statistics","responses":{"200":{"description":"Totals and top sources"}}}}}}