{"openapi":"3.1.0","info":{"title":"J&J Facebook Page Bridge","version":"1.1.0","description":"A customer management credential connects Facebook and creates separately scoped agent credentials. Each agent receives selected Page IDs and read-only or publishing access. Agent credentials cannot manage the customer connection or other agents. J&J operator credentials cannot perform customer Page actions. The user and agent establish consent protocols in their own chat. J&J does not approve individual posts. Facebook tokens are never returned. No public registration is available."},"servers":[{"url":"https://facebook-connect.jjtechnologypartners.com"}],"security":[{"clientBearer":[]}],"paths":{"/api/connect":{"post":{"operationId":"connectFacebook","summary":"Create a one-use ten-minute login invitation for the authenticated account","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Customer management credential required; agent credentials are rejected. Connect creates a browser-bound invitation; select changes only the convenience default. Disconnect revokes every agent; management-key rotation leaves independent agents intact."}},"/api/status":{"get":{"operationId":"connectionStatus","summary":"Verify current Meta grants and report connection readiness","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionStatus"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/pages":{"get":{"operationId":"listAuthorizedPages","summary":"List only this account’s stored authorized Pages","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Page"}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/select":{"post":{"operationId":"selectPage","summary":"Set the browser’s convenience selection","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"pageId":{"type":"string","pattern":"^[0-9]+$"}},"required":["pageId"]}}}},"description":"Customer management credential required; agent credentials are rejected. Connect creates a browser-bound invitation; select changes only the convenience default. Disconnect revokes every agent; management-key rotation leaves independent agents intact."}},"/api/page":{"get":{"operationId":"readPage","summary":"Read authorized Page details","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"pageId","in":"query","required":false,"description":"Required for agent credentials. Management credentials may omit it to use their default Page.","schema":{"type":"string","pattern":"^[0-9]+$"}}],"description":"Read a currently authorized Page. Agent credentials require an explicit pageId from their assigned Page allowlist. Only management credentials may omit pageId to use their convenience default."}},"/api/posts":{"get":{"operationId":"readPagePosts","summary":"Read recent Page-owned posts","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Posts"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"pageId","in":"query","required":false,"description":"Required for agent credentials. Management credentials may omit it to use their default Page.","schema":{"type":"string","pattern":"^[0-9]+$"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}}],"description":"Read a currently authorized Page. Agent credentials require an explicit pageId from their assigned Page allowlist. Only management credentials may omit pageId to use their convenience default."}},"/api/draft":{"post":{"operationId":"createDraft","summary":"Save text and Page for exact-payload publication; no human consent is inferred","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"pageId":{"type":"string","pattern":"^[0-9]+$"},"text":{"type":"string","minLength":1,"maxLength":63206}},"required":["text"]}}}},"description":"Agent drafts are private to the creating agent. Creating drafts and publishing require publishing access; read-only agents receive read_only (403). Requests outside the agent Page allowlist receive page_forbidden (403). Publishing requires pageId, the immutable draft ID and its exact textHash. Each draft dispatches at most once; inspect Page posts after publication_uncertain instead of retrying. Agent credentials require explicit pageId."},"get":{"operationId":"previewDraft","summary":"Read the saved draft and dispatch status","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"description":"Agent drafts are private to the creating agent. Creating drafts and publishing require publishing access; read-only agents receive read_only (403). Requests outside the agent Page allowlist receive page_forbidden (403). Publishing requires pageId, the immutable draft ID and its exact textHash. Each draft dispatches at most once; inspect Page posts after publication_uncertain instead of retrying."}},"/api/publish":{"post":{"operationId":"publishDraft","summary":"Publish the exact saved draft once using customer authentication","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Publication"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"pageId":{"type":"string","pattern":"^[0-9]+$"},"draftId":{"type":"string"},"hash":{"type":"string","description":"Exact textHash returned by createDraft"}},"required":["pageId","draftId","hash"]}}}},"description":"Agent drafts are private to the creating agent. Creating drafts and publishing require publishing access; read-only agents receive read_only (403). Requests outside the agent Page allowlist receive page_forbidden (403). Publishing requires pageId, the immutable draft ID and its exact textHash. Each draft dispatches at most once; inspect Page posts after publication_uncertain instead of retrying."}},"/api/credential/rotate":{"post":{"operationId":"rotateBridgeCredential","summary":"Replace this account’s credential; store the returned key securely before replacing the old one","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rotation"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Customer management credential required; agent credentials are rejected. Connect creates a browser-bound invitation; select changes only the convenience default. Disconnect revokes every agent; management-key rotation leaves independent agents intact."}},"/api/disconnect":{"post":{"operationId":"disconnectFacebook","summary":"Forget the Facebook connection and pending drafts; bridge credential remains valid","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"description":"Customer management credential required; agent credentials are rejected. Connect creates a browser-bound invitation; select changes only the convenience default. Disconnect revokes every agent; management-key rotation leaves independent agents intact."}},"/api/agents":{"get":{"operationId":"listAgents","summary":"List this customer’s agents without their credentials","description":"Customer management credential required. Agent and operator credentials are rejected.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createAgent","summary":"Create an independent agent credential for one or more authorized Pages","description":"Customer management credential required. Agent and operator credentials are rejected.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","pageIds"],"properties":{"agentId":{"type":"string"},"name":{"type":"string","maxLength":100},"pageIds":{"type":"array","minItems":1,"maxItems":1000,"uniqueItems":true,"items":{"type":"string","pattern":"^[0-9]+$"}},"canPublish":{"type":"boolean","description":"False enforces read-only access on the server.","default":false}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/agents/update":{"post":{"operationId":"updateAgent","summary":"Replace Page and publishing grants; clear this agent’s unsent drafts","description":"Customer management credential required. Agent and operator credentials are rejected.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agentId","pageIds","canPublish"],"properties":{"agentId":{"type":"string"},"name":{"type":"string","maxLength":100},"pageIds":{"type":"array","minItems":1,"maxItems":1000,"uniqueItems":true,"items":{"type":"string","pattern":"^[0-9]+$"}},"canPublish":{"type":"boolean","description":"False enforces read-only access on the server."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/agents/revoke":{"post":{"operationId":"revokeAgent","summary":"Revoke one agent credential","description":"Customer management credential required. Agent and operator credentials are rejected.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agentId"],"properties":{"agentId":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"revoked":{"type":"boolean"}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/agents/rotate":{"post":{"operationId":"rotateAgentCredential","summary":"Replace one agent credential; preserve other agents and dispatched outcomes","description":"Customer management credential required. Agent and operator credentials are rejected.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agentId"],"properties":{"agentId":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["id","agentKey"],"properties":{"id":{"type":"string"},"agentKey":{"type":"string","description":"Secret returned only on creation or rotation. Save privately; never log it."}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Invalid bridge credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing permissions or disabled publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Page or draft not accessible","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict, already published or uncertain publication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"Expired draft or invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Provider failure; publication may be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"clientBearer":{"type":"http","scheme":"bearer","description":"Private customer management or separately scoped agent credential; never a Facebook token or J&J operator key. Management endpoints reject agent credentials."}},"schemas":{"Page":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"Draft":{"type":"object","properties":{"id":{"type":"string"},"clientId":{"type":"string"},"pageId":{"type":"string"},"text":{"type":"string"},"textHash":{"type":"string"},"expiresAt":{"type":"integer","description":"Unix milliseconds"},"status":{"type":"string","enum":["draft","approved","dispatching","published","uncertain"]},"postId":{"type":["string","null"]}}},"Error":{"type":"object","required":["code","error"],"properties":{"code":{"type":"string"},"error":{"type":"string"}}},"ConnectionStatus":{"type":"object","properties":{"connected":{"type":"boolean"},"ready":{"type":"boolean"},"reason":{"type":"string"},"missingPermissions":{"type":"array","items":{"type":"string"}},"pages":{"type":"array","items":{"$ref":"#/components/schemas/Page"}},"selectedPageId":{"type":["string","null"]},"publishingEnabled":{"type":"boolean"},"role":{"type":"string","enum":["owner","agent"]},"agentId":{"type":["string","null"]},"readOnly":{"type":"boolean","description":"True means draft creation and publishing are forbidden for this credential."}},"required":["connected","ready"]},"Invitation":{"type":"object","properties":{"authorizationUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"integer"}},"required":["authorizationUrl","expiresAt"]},"Publication":{"type":"object","properties":{"status":{"type":"string","enum":["published"]},"postId":{"type":"string"}},"required":["status","postId"]},"Rotation":{"type":"object","properties":{"tenantId":{"type":"string"},"clientKey":{"type":"string","description":"Replacement secret. Store securely; never log this response."},"facebookConnectionRetained":{"type":"boolean"}},"required":["tenantId","clientKey"]},"Posts":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"hasNextPage":{"type":"boolean"}},"required":["data","hasNextPage"]},"Agent":{"type":"object","required":["id","name","canPublish","pageIds","revokedAt","createdAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"canPublish":{"type":"boolean"},"pageIds":{"type":"array","items":{"type":"string"}},"revokedAt":{"type":["integer","null"]},"createdAt":{"type":"integer"},"agentKey":{"type":"string","description":"Secret returned only on creation or rotation. Save privately; never log it."}}}}}}