openapi: 3.2.0 info: title: Piknik.Spot Analytics API description: Piknik.Spot API with OAuth2 authentication, Model Context Protocol (MCP) support, and Agent-to-Agent (A2A) capabilities for AI-powered local food system interactions. version: 1.0.0 contact: name: Piknik.Spot API Support url: https://piknik.spot email: info@piknik.spot license: name: Proprietary url: https://piknik.spot/terms servers: - url: https://piknik.spot/api description: Production Server - url: http://localhost:3000/api description: Development Server tags: - name: Analytics paths: /agritourism/campaigns/{id}/analytics: get: summary: GET /agritourism/campaigns/{id}/analytics description: Endpoint for /agritourism/campaigns/{id}/analytics tags: - Analytics responses: '200': description: Success content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: - bearerAuth: [] - cookieAuth: [] parameters: - name: id in: path required: true schema: type: string description: id identifier operationId: getAgritourismCampaignsByIdAnalytics x-operation-id-source: derived /analytics/entity/{entityType}/{entityId}: get: summary: GET /analytics/entity/{entityType}/{entityId} description: Endpoint for /analytics/entity/{entityType}/{entityId} tags: - Analytics responses: '200': description: Success content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: [] parameters: - name: entityType in: path required: true schema: type: string description: entityType identifier - name: entityId in: path required: true schema: type: string description: entityId identifier - name: days in: query schema: type: string description: days parameter operationId: getAnalyticsEntityByEntityTypeByEntityId x-operation-id-source: derived /analytics/fallback: post: summary: POST /analytics/fallback description: Endpoint for /analytics/fallback tags: - Analytics responses: '201': description: Created successfully content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: [] operationId: postAnalyticsFallback x-operation-id-source: derived get: summary: GET /analytics/fallback description: Endpoint for /analytics/fallback tags: - Analytics responses: '200': description: Success content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: [] operationId: getAnalyticsFallback x-operation-id-source: derived /analytics/metrics: get: summary: GET /analytics/metrics description: Endpoint for /analytics/metrics tags: - Analytics responses: '200': description: Success content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: - bearerAuth: [] - cookieAuth: [] parameters: - name: days in: query schema: type: string description: days parameter operationId: getAnalyticsMetrics x-operation-id-source: derived /analytics/track: post: summary: POST /analytics/track description: Endpoint for /analytics/track tags: - Analytics responses: '201': description: Created successfully content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: [] requestBody: required: true content: application/json: schema: type: object operationId: postAnalyticsTrack x-operation-id-source: derived /widget/analytics: get: summary: GET /api/widget/analytics tags: - Analytics responses: '200': description: Success content: application/json: schema: type: object '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/Error' security: [] parameters: - name: days in: query schema: type: string description: days parameter operationId: getWidgetAnalytics x-operation-id-source: derived components: schemas: Error: type: object properties: error: type: string description: Error message error_description: type: string description: Detailed error description securitySchemes: cookieAuth: type: apiKey in: cookie name: next-auth.session-token description: Session-based authentication for web browsers oauth2: type: oauth2 description: OAuth 2.0 authentication for external applications and AI agents flows: authorizationCode: authorizationUrl: https://piknik.spot/api/oauth/authorize tokenUrl: https://piknik.spot/api/oauth/token refreshUrl: https://piknik.spot/api/oauth/token scopes: marketplace:write: Create and manage marketplace listings events:write: Create and manage community events read:profile: Read user profile information write:profile: Update user profile information bearerAuth: type: http scheme: bearer bearerFormat: JWT description: 'OAuth2 access token (JWT). Include in Authorization header as: Bearer {token}'