{"openapi":"3.1.0","info":{"title":"desk2app API","version":"1.0.0","description":"Build with AI. Go mobile instantly. Push notifications with deep links, Face ID approvals and phone pairing for your own (AI-built) software. Authenticate server-side with a project API key: `Authorization: Bearer d2a_proj_...`. Never use the key in frontend code."},"servers":[{"url":"https://desk2app.digeo.nl"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Project API key (d2a_proj_…) or account token (d2a_acc_…)"}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable code, e.g. plan_limit_reached, invalid_deep_link, domain_not_verified"},"message":{"type":"string"},"details":{}},"required":["code","message"]}},"required":[]}}}}},"schemas":{"NotificationInput":{"type":"object","properties":{"projectId":{"type":"string","description":"Only when using an account token"},"userId":{"type":"string","description":"Your own user id of the recipient"},"title":{"type":"string","maxLength":200},"body":{"type":"string","description":"No sensitive data (shown on lock screen)","maxLength":1000},"deepLink":{"type":"string","description":"Path on your verified domain, e.g. /leads/123"},"category":{"type":"string"},"priority":{"enum":["normal","high"]},"dedupeKey":{"type":"string","description":"Same key within 24h returns the existing notification"}},"required":["userId","title"]},"Accepted":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["accepted","pending","duplicate","no_recipients"]},"recipients":{"type":"integer"}},"required":[]},"Notification":{"type":"object","properties":{"id":{"type":"string"},"kind":{"enum":["message","approval"]},"userId":{"type":"string"},"title":{"type":"string"},"deepLink":{"type":"string"},"status":{"enum":["no_recipients","queued","inbox_only","sent_to_provider","delivered_to_provider","received","opened","failed"],"description":"Honest status: only \"received\"/\"opened\" are confirmed by the phone."},"recipients":{"type":"integer"},"decision":{"type":"string","description":"Approvals only"},"decidedAt":{"type":"string"}},"required":[]},"PairingLink":{"type":"object","properties":{"code":{"type":"string","description":"ABCD-EFGH"},"url":{"type":"string","description":"Show as link + QR to the logged-in user"},"appUrl":{"type":"string"},"expiresAt":{"type":"string"}},"required":[]},"Project":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"origin":{"type":"string"},"color":{"type":"string"},"logoUrl":{"type":"string"},"verified":{"type":"boolean"},"verification":{}},"required":[]},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string"},"type":{"enum":["approval.decided","test"]},"createdAt":{"type":"string"},"data":{"type":"object","properties":{"approvalId":{"type":"string"},"userId":{"type":"string"},"decision":{"type":"string"},"biometricVerified":{"type":"boolean"}},"required":[]}},"required":[]}}},"paths":{"/v1/notifications":{"post":{"summary":"Send a push notification to all phones of a user","operationId":"sendNotification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationInput"}}}},"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Accepted"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/notifications/{id}":{"get":{"summary":"Delivery status","operationId":"getNotification","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Notification"}}}},"404":{"$ref":"#/components/responses/Error"}}}},"/v1/approvals":{"post":{"summary":"Ask a user to approve/reject an action (Face ID on the phone)","operationId":"requestApproval","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/NotificationInput"},{"type":"object","properties":{"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"destructive":{"type":"boolean"}},"required":[]}},"expiresIn":{"type":"integer","description":"seconds, default 86400"},"requireBiometric":{"type":"boolean","default":true}},"required":[]}]}}}},"responses":{"202":{"description":"Pending","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Accepted"}}}},"400":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/approvals/{id}":{"get":{"summary":"Approval status/decision","operationId":"getApproval","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Notification"}}}},"404":{"$ref":"#/components/responses/Error"}}}},"/v1/pairing-tokens":{"post":{"summary":"One-time link/QR/code to connect a user's phone (valid 10 min)","operationId":"createPairingLink","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"displayName":{"type":"string"},"projectId":{"type":"string"}},"required":["userId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PairingLink"}}}},"409":{"$ref":"#/components/responses/Error"}}}},"/v1/device-links/claim":{"post":{"summary":"Connect a phone using the link code shown in the app (for AI assistants)","operationId":"claimDeviceLink","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"userId":{"type":"string"},"projectId":{"type":"string"}},"required":["code","userId"]}}}},"responses":{"200":{"description":"Connected"},"404":{"$ref":"#/components/responses/Error"}}}},"/v1/connections":{"get":{"summary":"Connected phones","operationId":"listConnections","responses":{"200":{"description":"OK"}}}},"/v1/connections/revoke":{"post":{"summary":"Disconnect all phones of a user","operationId":"revokeConnections","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"connectionId":{"type":"string"},"projectId":{"type":"string"}},"required":[]}}}},"responses":{"200":{"description":"OK"}}}},"/v1/projects":{"get":{"summary":"List projects","operationId":"listProjects","responses":{"200":{"description":"OK"}}},"post":{"summary":"Register a portal (account token)","operationId":"createProject","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string","description":"Public https URL"},"color":{"type":"string"},"logoUrl":{"type":"string"},"logoutPath":{"type":"string"}},"required":["name","url"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"402":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/v1/projects/{id}":{"get":{"summary":"Get project","operationId":"getProject","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update project","operationId":"updateProject","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete project and revoke all connections/keys","operationId":"deleteProject","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/v1/projects/{id}/verify":{"post":{"summary":"Verify domain via /.well-known/desk2app-verify.txt or DNS TXT _desk2app.<host>","operationId":"verifyDomain","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Result"}}}},"/v1/projects/{id}/status":{"get":{"summary":"Integration checklist","operationId":"integrationStatus","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/v1/projects/{id}/keys":{"post":{"summary":"Create project API key (shown once)","operationId":"createKey","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Created"}}}},"/v1/projects/{id}/webhook":{"put":{"summary":"Set webhook URL (on the verified origin). Events are signed: header desk2app-signature: t=<unix>,v1=<hex HMAC-SHA256 of \"t.rawBody\">","operationId":"setWebhook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"responses":{"200":{"description":"Secret shown once"}}}},"/v1/usage":{"get":{"summary":"Usage this month and plan limits","operationId":"getUsage","responses":{"200":{"description":"OK"}}}},"/v1/auth/device/start":{"post":{"summary":"Start browser login for CLI/MCP tools (device flow)","operationId":"deviceStart","security":[],"responses":{"200":{"description":"OK"}}}},"/v1/auth/device/token":{"post":{"summary":"Poll for the account token after the user approved","operationId":"deviceToken","security":[],"responses":{"200":{"description":"Token"},"400":{"$ref":"#/components/responses/Error"}}}}},"x-webhooks":{"approval.decided":{"$ref":"#/components/schemas/WebhookEvent"}}}