{"openapi":"3.1.0","info":{"title":"SumBook PeopleBook Integration API","version":"1.0.0","description":"Implemented PeopleBook receiver only. This is not a general REST API, InvoiceNow provider API or accreditation claim. Read https://sumbook.wcreatesdigital.com/developers for readiness and integration guides."},"servers":[{"url":"https://sumbook.wcreatesdigital.com","description":"Production. No separate hosted sandbox; use a dedicated test company."}],"security":[{"PeopleBookKey":[]}],"paths":{"/api/integrations/peoplebook":{"get":{"operationId":"readPeopleBookConnection","summary":"Read the authorised company and eligible accounts","parameters":[{"name":"X-PeopleBook-Company","in":"header","required":true,"description":"The PeopleBook company UUID bound to this key, not the SumBook workspace UUID.","schema":{"type":"string","format":"uuid"}},{"name":"X-PeopleBook-UEN","in":"header","required":true,"description":"Exact uppercase UEN bound to the connection and matching the SumBook company.","schema":{"type":"string"}}],"responses":{"200":{"description":"Company identity and eligible expense/liability accounts. No pagination.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"400":{"description":"Invalid payload, accounting validation failure or integration reference limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Bearer key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Connection expired/revoked, owner changed, or company/UEN mismatch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Only GET, POST and DELETE are supported.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postPeopleBookAccrual","summary":"Post a finalised SGD payroll accrual","description":"Mutates the ledger. Maximum request text length 20,000 characters. Repeat the same externalReference with the identical payload for idempotent replay. Changed payload for an existing reference is rejected. Company locked periods apply. This does not transfer funds or submit statutory reports.","parameters":[{"name":"X-PeopleBook-Company","in":"header","required":true,"description":"The PeopleBook company UUID bound to this key, not the SumBook workspace UUID.","schema":{"type":"string","format":"uuid"}},{"name":"X-PeopleBook-UEN","in":"header","required":true,"description":"Exact uppercase UEN bound to the connection and matching the SumBook company.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollJournal"}}}},"responses":{"200":{"description":"Identical replay of a previously posted accrual; duplicate=true.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalResult"}}}},"201":{"description":"Payroll accrual posted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalResult"}}}},"400":{"description":"Invalid payload, accounting validation failure or integration reference limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Bearer key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Connection expired/revoked, owner changed, or company/UEN mismatch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Only GET, POST and DELETE are supported.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Same reference with different data or concurrent workspace update. Reconcile before retrying.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request text exceeds 20,000 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"revokePeopleBookConnection","summary":"Revoke the current connection","description":"Immediately invalidates the current key. Do not call as a connectivity test.","parameters":[{"name":"X-PeopleBook-Company","in":"header","required":true,"description":"The PeopleBook company UUID bound to this key, not the SumBook workspace UUID.","schema":{"type":"string","format":"uuid"}},{"name":"X-PeopleBook-UEN","in":"header","required":true,"description":"Exact uppercase UEN bound to the connection and matching the SumBook company.","schema":{"type":"string"}}],"responses":{"200":{"description":"Connection revoked.","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}}}}}},"400":{"description":"Invalid payload, accounting validation failure or integration reference limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or malformed Bearer key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Connection expired/revoked, owner changed, or company/UEN mismatch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"Only GET, POST and DELETE are supported.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Concurrent workspace update; refresh and retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"PeopleBookKey":{"type":"http","scheme":"bearer","bearerFormat":"sb_pb_<64 lowercase hexadecimal characters>","description":"Create through owner-only PeopleBook authorisation. Supports optional expiry or no expiry until revoked. Do not reuse an MCP key or a browser session."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"Connection":{"type":"object","required":["workspaceId","companyName","uen","expiresAt","accounts","capabilities"],"properties":{"workspaceId":{"type":"string","format":"uuid"},"companyName":{"type":"string"},"uen":{"type":"string"},"expiresAt":{"type":["string","null"],"format":"date-time"},"accounts":{"type":"array","items":{"type":"object","required":["code","name","type"],"properties":{"code":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["EXPENSE","LIABILITY"]}}}},"capabilities":{"type":"array","items":{"type":"string","enum":["accounts.read","payroll.accrual.write"]}}}},"PayrollJournal":{"type":"object","required":["schemaVersion","currency","status","externalReference","date","description","lines"],"properties":{"schemaVersion":{"const":"peoplebook.journal.v1"},"currency":{"const":"SGD"},"status":{"const":"finalised"},"externalReference":{"type":"string","maxLength":160,"pattern":"^PeopleBook:","description":"Must start PeopleBook:<exact connected company UUID>: and contain a stable unique payrun reference. Up to 10,000 imported references per workspace."},"date":{"type":"string","format":"date"},"description":{"type":"string"},"lines":{"type":"array","minItems":2,"maxItems":32,"description":"Balanced aggregate payroll journal. EXPENSE debits and LIABILITY credits only; exclude 2000 and 2100.","items":{"$ref":"#/components/schemas/JournalLine"}}}},"JournalLine":{"type":"object","required":["account","debit","credit"],"properties":{"account":{"type":"string","description":"Eligible code returned by GET."},"debit":{"type":"integer","minimum":0,"maximum":100000000000,"description":"SGD cents."},"credit":{"type":"integer","minimum":0,"maximum":100000000000,"description":"SGD cents."}},"oneOf":[{"properties":{"debit":{"minimum":1},"credit":{"const":0}}},{"properties":{"debit":{"const":0},"credit":{"minimum":1}}}]},"JournalResult":{"type":"object","required":["journalId","externalReference","status"],"properties":{"journalId":{"type":"string","format":"uuid"},"externalReference":{"type":"string"},"status":{"const":"posted"},"duplicate":{"type":"boolean"}}}}},"externalDocs":{"url":"https://sumbook.wcreatesdigital.com/developers","description":"SumBook developer documentation and integration readiness"}}