openapi: 3.0.3 info: title: Alfred API version: 1.0.0 description: iOS v1 API for Alfred (Gmail + Calendar + push notifications). servers: - url: https://api.alfredapp.com tags: - name: Devices - name: Assistant - name: Connectors - name: Automations - name: Audit - name: Privacy paths: /v1/devices/apns: post: tags: [Devices] summary: Register APNs token for device operationId: registerAPNSDevice security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterDeviceRequest" responses: "200": description: APNs registration succeeded content: application/json: schema: $ref: "#/components/schemas/OkResponse" "401": $ref: "#/components/responses/Unauthorized" /v1/devices/apns/test: post: tags: [Devices] summary: Queue a test push notification operationId: sendAPNSTestNotification security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendTestNotificationRequest" responses: "200": description: Test notification queued content: application/json: schema: $ref: "#/components/schemas/SendTestNotificationResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" /v1/assistant/query: post: tags: [Assistant] summary: Query assistant with encrypted envelope operationId: queryAssistant security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AssistantQueryRequest" responses: "200": description: Assistant query response content: application/json: schema: $ref: "#/components/schemas/AssistantQueryResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "429": $ref: "#/components/responses/TooManyRequests" "502": $ref: "#/components/responses/BadGateway" /v1/assistant/attested-key: post: tags: [Assistant] summary: Fetch attested enclave assistant encryption key operationId: fetchAssistantAttestedKey security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AssistantAttestedKeyRequest" responses: "200": description: Attested assistant encryption key content: application/json: schema: $ref: "#/components/schemas/AssistantAttestedKeyResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "429": $ref: "#/components/responses/TooManyRequests" "502": $ref: "#/components/responses/BadGateway" /v1/assistant/sessions: get: tags: [Assistant] summary: List assistant thread sessions for the current user operationId: listAssistantSessions security: - bearerAuth: [] responses: "200": description: Assistant sessions content: application/json: schema: $ref: "#/components/schemas/ListAssistantSessionsResponse" "401": $ref: "#/components/responses/Unauthorized" delete: tags: [Assistant] summary: Delete all assistant thread sessions for the current user operationId: deleteAllAssistantSessions security: - bearerAuth: [] responses: "200": description: Assistant sessions deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" "401": $ref: "#/components/responses/Unauthorized" /v1/assistant/sessions/{session_id}: delete: tags: [Assistant] summary: Delete a single assistant thread session operationId: deleteAssistantSession security: - bearerAuth: [] parameters: - in: path name: session_id required: true schema: type: string format: uuid responses: "200": description: Assistant session deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /v1/connectors: get: tags: [Connectors] summary: List connector states for the current user operationId: listConnectors security: - bearerAuth: [] responses: "200": description: Connector states content: application/json: schema: $ref: "#/components/schemas/ListConnectorsResponse" "401": $ref: "#/components/responses/Unauthorized" /v1/connectors/google/start: post: tags: [Connectors] summary: Start Google OAuth flow operationId: startGoogleOAuth security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StartGoogleConnectRequest" responses: "200": description: OAuth URL generated content: application/json: schema: $ref: "#/components/schemas/StartGoogleConnectResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "429": $ref: "#/components/responses/TooManyRequests" /v1/connectors/google/callback: post: tags: [Connectors] summary: Complete Google OAuth flow operationId: completeGoogleOAuth security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CompleteGoogleConnectRequest" responses: "200": description: Connector activated content: application/json: schema: $ref: "#/components/schemas/CompleteGoogleConnectResponse" "400": $ref: "#/components/responses/BadRequest" "502": $ref: "#/components/responses/BadGateway" "401": $ref: "#/components/responses/Unauthorized" "429": $ref: "#/components/responses/TooManyRequests" /v1/connectors/{connector_id}: delete: tags: [Connectors] summary: Revoke connector operationId: revokeConnector security: - bearerAuth: [] parameters: - in: path name: connector_id required: true schema: type: string responses: "200": description: Connector revoked content: application/json: schema: $ref: "#/components/schemas/RevokeConnectorResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "502": $ref: "#/components/responses/BadGateway" "429": $ref: "#/components/responses/TooManyRequests" /v1/automations: get: tags: [Automations] summary: List automation rules for the current user operationId: listAutomations security: - bearerAuth: [] parameters: - in: query name: limit schema: type: integer minimum: 1 maximum: 200 responses: "200": description: Automation rules content: application/json: schema: $ref: "#/components/schemas/ListAutomationsResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Automations] summary: Create a periodic automation rule operationId: createAutomation security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateAutomationRequest" responses: "200": description: Automation rule created content: application/json: schema: $ref: "#/components/schemas/AutomationRuleSummary" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "429": $ref: "#/components/responses/TooManyRequests" /v1/automations/{rule_id}: patch: tags: [Automations] summary: Update an automation rule (schedule, prompt envelope, or status) operationId: updateAutomation security: - bearerAuth: [] parameters: - in: path name: rule_id required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateAutomationRequest" responses: "200": description: Automation rule updated content: application/json: schema: $ref: "#/components/schemas/AutomationRuleSummary" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "429": $ref: "#/components/responses/TooManyRequests" delete: tags: [Automations] summary: Delete an automation rule operationId: deleteAutomation security: - bearerAuth: [] parameters: - in: path name: rule_id required: true schema: type: string format: uuid responses: "200": description: Automation rule deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "429": $ref: "#/components/responses/TooManyRequests" /v1/automations/{rule_id}/debug/run: post: tags: [Automations] summary: Enqueue an immediate debug run for an automation rule (local/dev only) operationId: triggerAutomationDebugRun security: - bearerAuth: [] parameters: - in: path name: rule_id required: true schema: type: string format: uuid responses: "200": description: Debug automation run queued content: application/json: schema: $ref: "#/components/schemas/TriggerAutomationDebugRunResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "429": $ref: "#/components/responses/TooManyRequests" /v1/audit-events: get: tags: [Audit] summary: List redacted audit events operationId: listAuditEvents security: - bearerAuth: [] parameters: - in: query name: cursor schema: type: string responses: "200": description: Paginated audit events content: application/json: schema: $ref: "#/components/schemas/ListAuditEventsResponse" "401": $ref: "#/components/responses/Unauthorized" /v1/privacy/delete-all: post: tags: [Privacy] summary: Queue delete-all request operationId: requestDeleteAll security: - bearerAuth: [] responses: "200": description: Delete request queued content: application/json: schema: $ref: "#/components/schemas/DeleteAllResponse" "401": $ref: "#/components/responses/Unauthorized" "429": $ref: "#/components/responses/TooManyRequests" /v1/privacy/delete-all/{request_id}: get: tags: [Privacy] summary: Get delete-all request status operationId: getDeleteAllStatus security: - bearerAuth: [] parameters: - in: path name: request_id required: true schema: type: string responses: "200": description: Delete request status content: application/json: schema: $ref: "#/components/schemas/DeleteAllStatusResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT responses: BadRequest: description: Request rejected due to invalid input or OAuth error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" BadGateway: description: Upstream OAuth provider unavailable or failed content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" Unauthorized: description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" NotFound: description: Resource not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" TooManyRequests: description: Request rejected by endpoint rate limiting headers: Retry-After: schema: type: integer minimum: 1 description: Seconds before retrying the request. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" schemas: RegisterDeviceRequest: type: object required: [device_id, apns_token, environment] properties: device_id: type: string apns_token: type: string environment: type: string enum: [sandbox, production] notification_key_algorithm: type: string nullable: true enum: [x25519-chacha20poly1305] notification_public_key: type: string nullable: true description: Base64-encoded 32-byte X25519 public key. SendTestNotificationRequest: type: object properties: title: type: string nullable: true maxLength: 120 body: type: string nullable: true maxLength: 500 SendTestNotificationResponse: type: object required: [queued_job_id, status] properties: queued_job_id: type: string status: type: string enum: [QUEUED] AssistantQueryRequest: type: object required: [envelope] properties: envelope: $ref: "#/components/schemas/AssistantEncryptedRequestEnvelope" session_id: type: string format: uuid AssistantEncryptedRequestEnvelope: type: object required: [ version, algorithm, key_id, request_id, client_ephemeral_public_key, nonce, ciphertext ] properties: version: type: string enum: [v1] algorithm: type: string enum: [x25519-chacha20poly1305] key_id: type: string request_id: type: string client_ephemeral_public_key: type: string nonce: type: string ciphertext: type: string AssistantEncryptedResponseEnvelope: type: object required: [version, algorithm, key_id, request_id, nonce, ciphertext] properties: version: type: string enum: [v1] algorithm: type: string enum: [x25519-chacha20poly1305] key_id: type: string request_id: type: string nonce: type: string ciphertext: type: string AssistantQueryCapability: type: string enum: [ meetings_today, calendar_lookup, email_lookup, general_chat, mixed ] AssistantStructuredPayload: type: object required: [title, summary, key_points, follow_ups] properties: title: type: string summary: type: string key_points: type: array items: type: string follow_ups: type: array items: type: string AssistantQueryResponse: type: object required: [session_id, envelope] properties: session_id: type: string format: uuid envelope: $ref: "#/components/schemas/AssistantEncryptedResponseEnvelope" AssistantSessionSummary: type: object required: [session_id, created_at, updated_at, expires_at] properties: session_id: type: string format: uuid created_at: type: string format: date-time updated_at: type: string format: date-time expires_at: type: string format: date-time ListAssistantSessionsResponse: type: object required: [items] properties: items: type: array items: $ref: "#/components/schemas/AssistantSessionSummary" AssistantAttestedKeyRequest: type: object required: [challenge_nonce, issued_at, expires_at, request_id] properties: challenge_nonce: type: string issued_at: type: integer format: int64 expires_at: type: integer format: int64 request_id: type: string AssistantAttestedKeyAttestation: type: object required: [ runtime, measurement, challenge_nonce, issued_at, expires_at, request_id, evidence_issued_at ] properties: runtime: type: string measurement: type: string challenge_nonce: type: string issued_at: type: integer format: int64 expires_at: type: integer format: int64 request_id: type: string evidence_issued_at: type: integer format: int64 signature: type: string nullable: true AssistantAttestedKeyResponse: type: object required: [key_id, algorithm, public_key, key_expires_at, attestation] properties: key_id: type: string algorithm: type: string enum: [x25519-chacha20poly1305] public_key: type: string key_expires_at: type: integer format: int64 attestation: $ref: "#/components/schemas/AssistantAttestedKeyAttestation" StartGoogleConnectRequest: type: object required: [redirect_uri] properties: redirect_uri: type: string format: uri StartGoogleConnectResponse: type: object required: [auth_url, state] properties: auth_url: type: string format: uri state: type: string CompleteGoogleConnectRequest: type: object required: [state] properties: code: type: string nullable: true state: type: string error: type: string error_description: type: string CompleteGoogleConnectResponse: type: object required: [connector_id, status, granted_scopes] properties: connector_id: type: string status: type: string enum: [ACTIVE] granted_scopes: type: array items: type: string RevokeConnectorResponse: type: object required: [status] properties: status: type: string enum: [REVOKED] ConnectorSummary: type: object required: [connector_id, provider, status] properties: connector_id: type: string provider: type: string enum: [google] status: type: string enum: [ACTIVE, REVOKED] ListConnectorsResponse: type: object required: [items] properties: items: type: array items: $ref: "#/components/schemas/ConnectorSummary" AutomationPromptEnvelope: type: object required: [ version, algorithm, key_id, request_id, client_ephemeral_public_key, nonce, ciphertext ] properties: version: type: string enum: [v1] algorithm: type: string enum: [x25519-chacha20poly1305] key_id: type: string minLength: 1 request_id: type: string minLength: 1 client_ephemeral_public_key: type: string description: Base64-encoded 32-byte X25519 public key. nonce: type: string description: Base64-encoded 12-byte nonce. ciphertext: type: string description: Base64-encoded encrypted automation prompt payload. CreateAutomationRequest: type: object required: [title, schedule, prompt_envelope] properties: title: type: string description: User-visible task title. minLength: 1 maxLength: 120 schedule: $ref: "#/components/schemas/AutomationSchedule" prompt_envelope: $ref: "#/components/schemas/AutomationPromptEnvelope" AutomationSchedule: type: object required: [schedule_type, time_zone, local_time] properties: schedule_type: $ref: "#/components/schemas/AutomationScheduleType" time_zone: type: string description: IANA timezone identifier (for example, America/Los_Angeles). minLength: 1 maxLength: 64 local_time: type: string description: 24-hour local time in HH:MM format. pattern: "^([01]\\d|2[0-3]):[0-5]\\d$" AutomationStatus: type: string enum: [ACTIVE, PAUSED] UpdateAutomationRequest: type: object properties: title: type: string description: Updated user-visible task title. minLength: 1 maxLength: 120 schedule: $ref: "#/components/schemas/AutomationSchedule" prompt_envelope: $ref: "#/components/schemas/AutomationPromptEnvelope" status: $ref: "#/components/schemas/AutomationStatus" AutomationScheduleType: type: string enum: [DAILY, WEEKLY, MONTHLY, ANNUALLY] AutomationRuleSummary: type: object required: [ rule_id, title, status, schedule, next_run_at, prompt_sha256, created_at, updated_at ] properties: rule_id: type: string format: uuid title: type: string status: $ref: "#/components/schemas/AutomationStatus" schedule: $ref: "#/components/schemas/AutomationSchedule" next_run_at: type: string format: date-time last_run_at: type: string format: date-time nullable: true prompt_sha256: type: string created_at: type: string format: date-time updated_at: type: string format: date-time ListAutomationsResponse: type: object required: [items] properties: items: type: array items: $ref: "#/components/schemas/AutomationRuleSummary" TriggerAutomationDebugRunResponse: type: object required: [queued_job_id, status] properties: queued_job_id: type: string format: uuid status: type: string AuditEvent: type: object required: [id, timestamp, event_type, result, metadata] properties: id: type: string timestamp: type: string format: date-time event_type: type: string connector: type: string nullable: true result: type: string enum: [SUCCESS, FAILURE] metadata: type: object additionalProperties: true ListAuditEventsResponse: type: object required: [items] properties: items: type: array items: $ref: "#/components/schemas/AuditEvent" next_cursor: type: string nullable: true DeleteAllResponse: type: object required: [request_id, status] properties: request_id: type: string status: type: string enum: [QUEUED] DeleteAllStatusResponse: type: object required: [request_id, status, created_at] properties: request_id: type: string status: type: string enum: [QUEUED, RUNNING, COMPLETED, FAILED] created_at: type: string format: date-time started_at: type: string format: date-time nullable: true completed_at: type: string format: date-time nullable: true failed_at: type: string format: date-time nullable: true OkResponse: type: object required: [ok] properties: ok: type: boolean ErrorResponse: type: object required: [error] properties: error: type: object required: [code, message] properties: code: type: string message: type: string