{ "openapi": "3.0.3", "info": { "title": "Acme API", "version": "0.1.0" }, "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } }, "schemas": {}, "parameters": {} }, "paths": { "/health": { "get": { "tags": ["System"], "responses": { "200": { "description": "The API is fully configured.", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "enum": ["ok", "degraded"] }, "stage": { "type": "string" }, "requestId": { "type": "string" }, "checks": { "type": "object", "properties": { "database": { "type": "boolean" }, "storage": { "type": "boolean" }, "queue": { "type": "boolean" }, "cors": { "type": "boolean" }, "optionalWebhookSecret": { "type": "boolean" }, "clerkAuthConfigured": { "type": "boolean" } }, "required": [ "database", "storage", "queue", "cors", "optionalWebhookSecret", "clerkAuthConfigured" ] }, "degradedReasons": { "type": "array", "items": { "type": "string" } } }, "required": [ "status", "stage", "requestId", "checks", "degradedReasons" ] } } } }, "503": { "description": "The API is reachable but degraded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "enum": ["ok", "degraded"] }, "stage": { "type": "string" }, "requestId": { "type": "string" }, "checks": { "type": "object", "properties": { "database": { "type": "boolean" }, "storage": { "type": "boolean" }, "queue": { "type": "boolean" }, "cors": { "type": "boolean" }, "optionalWebhookSecret": { "type": "boolean" }, "clerkAuthConfigured": { "type": "boolean" } }, "required": [ "database", "storage", "queue", "cors", "optionalWebhookSecret", "clerkAuthConfigured" ] }, "degradedReasons": { "type": "array", "items": { "type": "string" } } }, "required": [ "status", "stage", "requestId", "checks", "degradedReasons" ] } } } } } } }, "/v1/webhooks/clerk": { "post": { "tags": ["Identity"], "security": [], "responses": { "200": { "description": "Event accepted." }, "401": { "description": "Invalid signature or missing Svix headers.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/receipts/{id}/view": { "get": { "tags": ["Receipts"], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" }, { "schema": { "type": "string" }, "required": true, "name": "token", "in": "query" }, { "schema": { "type": "string" }, "required": true, "name": "expires", "in": "query" } ], "responses": { "200": { "description": "The raw receipt image." }, "400": { "description": "Invalid or expired token.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Receipt not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/me": { "get": { "tags": ["Identity"], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "The authenticated user profile.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "clerkUserId": { "type": "string" }, "email": { "type": "string", "nullable": true }, "reminderLeadDays": { "type": "integer", "minimum": 0, "maximum": 365 }, "pushEnabled": { "type": "boolean" }, "timezone": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "deletedAt": { "type": "string", "nullable": true } }, "required": [ "id", "clerkUserId", "email", "reminderLeadDays", "pushEnabled", "timezone", "createdAt", "updatedAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "User not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "503": { "description": "Authentication is not configured.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "patch": { "tags": ["Identity"], "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "reminderLeadDays": { "type": "integer", "minimum": 0, "maximum": 365 }, "pushEnabled": { "type": "boolean" }, "timezone": { "type": "string", "minLength": 1 } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "The updated user profile.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "clerkUserId": { "type": "string" }, "email": { "type": "string", "nullable": true }, "reminderLeadDays": { "type": "integer", "minimum": 0, "maximum": 365 }, "pushEnabled": { "type": "boolean" }, "timezone": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "deletedAt": { "type": "string", "nullable": true } }, "required": [ "id", "clerkUserId", "email", "reminderLeadDays", "pushEnabled", "timezone", "createdAt", "updatedAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "delete": { "tags": ["Identity"], "security": [ { "bearerAuth": [] } ], "responses": { "202": { "description": "Account deletion job recorded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "enum": ["deletion_pending"] } }, "required": ["status"] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/purchases": { "get": { "tags": ["Purchases"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "maxLength": 100 }, "required": false, "name": "q", "in": "query" }, { "schema": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "required": false, "name": "category", "in": "query" }, { "schema": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "required": false, "name": "deliveryStatus", "in": "query" }, { "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "required": false, "name": "from", "in": "query" }, { "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "required": false, "name": "to", "in": "query" }, { "schema": { "type": "string", "enum": ["purchaseDate", "createdAt", "amount"], "default": "createdAt" }, "required": false, "name": "sort", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "cursor", "in": "query" }, { "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 }, "required": false, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "A page of purchases, newest first.", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": [ "ordered", "shipped", "delivered", "cancelled" ] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "deletedAt": { "type": "string", "nullable": true, "format": "date-time" } }, "required": [ "id", "userId", "title", "merchant", "category", "purchaseDate", "amountMinor", "currency", "orderNumber", "notes", "deliveryStatus", "trackingNumber", "carrier", "warrantyExpiresAt", "returnDeadlineAt", "createdAt", "updatedAt" ] } }, "nextCursor": { "type": "string", "nullable": true } }, "required": ["items", "nextCursor"] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "post": { "tags": ["Purchases"], "security": [ { "bearerAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" } }, "required": ["title"], "additionalProperties": false } } } }, "responses": { "201": { "description": "The created purchase.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "deletedAt": { "type": "string", "nullable": true, "format": "date-time" }, "receipts": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "purchaseId": { "type": "string" }, "userId": { "type": "string" }, "contentType": { "type": "string" }, "sizeBytes": { "type": "integer", "minimum": 0 }, "width": { "type": "integer", "nullable": true, "minimum": 0 }, "height": { "type": "integer", "nullable": true, "minimum": 0 }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "purchaseId", "userId", "contentType", "sizeBytes", "width", "height", "createdAt" ] } }, "claims": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } }, "reminders": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "kind": { "type": "string", "enum": ["warranty_expiry", "return_deadline"] }, "fireOn": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "sentAt": { "type": "string", "nullable": true, "format": "date-time" }, "dismissedAt": { "type": "string", "nullable": true, "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "kind", "fireOn", "sentAt", "dismissedAt", "createdAt" ] } } }, "required": [ "id", "userId", "title", "merchant", "category", "purchaseDate", "amountMinor", "currency", "orderNumber", "notes", "deliveryStatus", "trackingNumber", "carrier", "warrantyExpiresAt", "returnDeadlineAt", "createdAt", "updatedAt", "receipts", "claims", "reminders" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/purchases/{id}": { "get": { "tags": ["Purchases"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "200": { "description": "The purchase detail.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "deletedAt": { "type": "string", "nullable": true, "format": "date-time" }, "receipts": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "purchaseId": { "type": "string" }, "userId": { "type": "string" }, "contentType": { "type": "string" }, "sizeBytes": { "type": "integer", "minimum": 0 }, "width": { "type": "integer", "nullable": true, "minimum": 0 }, "height": { "type": "integer", "nullable": true, "minimum": 0 }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "purchaseId", "userId", "contentType", "sizeBytes", "width", "height", "createdAt" ] } }, "claims": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } }, "reminders": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "kind": { "type": "string", "enum": ["warranty_expiry", "return_deadline"] }, "fireOn": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "sentAt": { "type": "string", "nullable": true, "format": "date-time" }, "dismissedAt": { "type": "string", "nullable": true, "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "kind", "fireOn", "sentAt", "dismissedAt", "createdAt" ] } } }, "required": [ "id", "userId", "title", "merchant", "category", "purchaseDate", "amountMinor", "currency", "orderNumber", "notes", "deliveryStatus", "trackingNumber", "carrier", "warrantyExpiresAt", "returnDeadlineAt", "createdAt", "updatedAt", "receipts", "claims", "reminders" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Purchase not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "patch": { "tags": ["Purchases"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "The updated purchase.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "deletedAt": { "type": "string", "nullable": true, "format": "date-time" }, "receipts": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "purchaseId": { "type": "string" }, "userId": { "type": "string" }, "contentType": { "type": "string" }, "sizeBytes": { "type": "integer", "minimum": 0 }, "width": { "type": "integer", "nullable": true, "minimum": 0 }, "height": { "type": "integer", "nullable": true, "minimum": 0 }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "purchaseId", "userId", "contentType", "sizeBytes", "width", "height", "createdAt" ] } }, "claims": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } }, "reminders": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "kind": { "type": "string", "enum": ["warranty_expiry", "return_deadline"] }, "fireOn": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "sentAt": { "type": "string", "nullable": true, "format": "date-time" }, "dismissedAt": { "type": "string", "nullable": true, "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "kind", "fireOn", "sentAt", "dismissedAt", "createdAt" ] } } }, "required": [ "id", "userId", "title", "merchant", "category", "purchaseDate", "amountMinor", "currency", "orderNumber", "notes", "deliveryStatus", "trackingNumber", "carrier", "warrantyExpiresAt", "returnDeadlineAt", "createdAt", "updatedAt", "receipts", "claims", "reminders" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Purchase not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "delete": { "tags": ["Purchases"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "204": { "description": "Purchase soft-deleted." }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Purchase not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/purchases/{id}/restore": { "post": { "tags": ["Purchases"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "200": { "description": "The restored purchase.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "merchant": { "type": "string", "nullable": true, "maxLength": 200 }, "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "purchaseDate": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "amountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "orderNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "deliveryStatus": { "type": "string", "enum": ["ordered", "shipped", "delivered", "cancelled"] }, "trackingNumber": { "type": "string", "nullable": true, "maxLength": 200 }, "carrier": { "type": "string", "nullable": true, "maxLength": 100 }, "warrantyExpiresAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "returnDeadlineAt": { "type": "string", "nullable": true, "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "deletedAt": { "type": "string", "nullable": true, "format": "date-time" }, "receipts": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "purchaseId": { "type": "string" }, "userId": { "type": "string" }, "contentType": { "type": "string" }, "sizeBytes": { "type": "integer", "minimum": 0 }, "width": { "type": "integer", "nullable": true, "minimum": 0 }, "height": { "type": "integer", "nullable": true, "minimum": 0 }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "purchaseId", "userId", "contentType", "sizeBytes", "width", "height", "createdAt" ] } }, "claims": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } }, "reminders": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "kind": { "type": "string", "enum": ["warranty_expiry", "return_deadline"] }, "fireOn": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "sentAt": { "type": "string", "nullable": true, "format": "date-time" }, "dismissedAt": { "type": "string", "nullable": true, "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "kind", "fireOn", "sentAt", "dismissedAt", "createdAt" ] } } }, "required": [ "id", "userId", "title", "merchant", "category", "purchaseDate", "amountMinor", "currency", "orderNumber", "notes", "deliveryStatus", "trackingNumber", "carrier", "warrantyExpiresAt", "returnDeadlineAt", "createdAt", "updatedAt", "receipts", "claims", "reminders" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Purchase not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/purchases/{id}/receipts": { "post": { "tags": ["Receipts"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "type": "string", "format": "binary", "description": "Receipt image file" } } } } } }, "responses": { "201": { "description": "The uploaded receipt.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "purchaseId": { "type": "string" }, "userId": { "type": "string" }, "contentType": { "type": "string" }, "sizeBytes": { "type": "integer", "minimum": 0 }, "width": { "type": "integer", "nullable": true, "minimum": 0 }, "height": { "type": "integer", "nullable": true, "minimum": 0 }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "purchaseId", "userId", "contentType", "sizeBytes", "width", "height", "createdAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Purchase not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed (invalid file size or type).", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/receipts/{id}": { "get": { "tags": ["Receipts"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "302": { "description": "Redirect to signed view URL." }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Receipt not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "delete": { "tags": ["Receipts"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "204": { "description": "Receipt deleted." }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Receipt not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/claims": { "get": { "tags": ["Claims"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": false, "name": "purchaseId", "in": "query" }, { "schema": { "type": "string", "enum": ["return", "refund", "warranty"] }, "required": false, "name": "type", "in": "query" }, { "schema": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "required": false, "name": "status", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "cursor", "in": "query" }, { "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 }, "required": false, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "List of claims.", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } }, "nextCursor": { "type": "string", "nullable": true } }, "required": ["items", "nextCursor"] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "post": { "tags": ["Claims"], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ], "default": "draft" }, "openedAt": { "type": "string", "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 } }, "required": ["purchaseId", "type"] } } } }, "responses": { "201": { "description": "The created claim.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Purchase not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/claims/{id}": { "get": { "tags": ["Claims"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "200": { "description": "The claim detail.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Claim not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } }, "patch": { "tags": ["Claims"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 } } } } } }, "responses": { "200": { "description": "The updated claim.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "type": { "type": "string", "enum": ["return", "refund", "warranty"] }, "status": { "type": "string", "enum": [ "draft", "submitted", "in_progress", "approved", "rejected", "completed", "cancelled" ] }, "openedAt": { "type": "string", "format": "date-time" }, "resolvedAt": { "type": "string", "nullable": true, "format": "date-time" }, "refundAmountMinor": { "type": "integer", "nullable": true, "minimum": 0 }, "reference": { "type": "string", "nullable": true, "maxLength": 200 }, "notes": { "type": "string", "nullable": true, "maxLength": 5000 }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "type", "status", "openedAt", "resolvedAt", "refundAmountMinor", "reference", "notes", "createdAt", "updatedAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Claim not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/reminders": { "get": { "tags": ["Reminders"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "enum": ["upcoming", "history"], "default": "upcoming" }, "required": false, "name": "scope", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "cursor", "in": "query" }, { "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 }, "required": false, "name": "limit", "in": "query" } ], "responses": { "200": { "description": "List of reminders.", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "kind": { "type": "string", "enum": ["warranty_expiry", "return_deadline"] }, "fireOn": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "sentAt": { "type": "string", "nullable": true, "format": "date-time" }, "dismissedAt": { "type": "string", "nullable": true, "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "kind", "fireOn", "sentAt", "dismissedAt", "createdAt" ] } }, "nextCursor": { "type": "string", "nullable": true } }, "required": ["items", "nextCursor"] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/reminders/{id}/dismiss": { "post": { "tags": ["Reminders"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "200": { "description": "The dismissed reminder.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "purchaseId": { "type": "string" }, "kind": { "type": "string", "enum": ["warranty_expiry", "return_deadline"] }, "fireOn": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "sentAt": { "type": "string", "nullable": true, "format": "date-time" }, "dismissedAt": { "type": "string", "nullable": true, "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "purchaseId", "kind", "fireOn", "sentAt", "dismissedAt", "createdAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Reminder not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/devices": { "post": { "tags": ["Devices"], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "expoPushToken": { "type": "string", "minLength": 1 }, "platform": { "type": "string", "enum": ["ios", "android"] } }, "required": ["expoPushToken", "platform"] } } } }, "responses": { "200": { "description": "The registered device.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "expoPushToken": { "type": "string" }, "platform": { "type": "string", "enum": ["ios", "android"] }, "lastSeenAt": { "type": "string", "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "userId", "expoPushToken", "platform", "lastSeenAt", "createdAt" ] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "422": { "description": "Validation failed.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/devices/{id}": { "delete": { "tags": ["Devices"], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "id", "in": "path" } ], "responses": { "204": { "description": "Device deleted successfully." }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } }, "404": { "description": "Device not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } }, "/v1/meta/categories": { "get": { "tags": ["Meta"], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Category list with default warranty and return windows.", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "category": { "type": "string", "enum": [ "electronics", "appliances", "furniture", "clothing", "vehicle", "home_improvement", "services", "other" ] }, "defaultReturnDays": { "type": "integer", "minimum": 0 }, "defaultWarrantyDays": { "type": "integer", "minimum": 0 } }, "required": [ "category", "defaultReturnDays", "defaultWarrantyDays" ] } } }, "required": ["items"] } } } }, "401": { "description": "Unauthenticated.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "unauthenticated", "forbidden", "not_found", "conflict", "validation_failed", "rate_limited", "internal", "unavailable", "auth_not_configured" ] }, "message": { "type": "string" }, "fields": { "type": "object", "additionalProperties": { "type": "string" } } }, "required": ["code", "message"] }, "requestId": { "type": "string" } }, "required": ["error", "requestId"] } } } } } } } } }