openapi: 3.0.3 info: title: Friendbuy Merchant Analytics Customers API description: 'The Friendbuy Merchant API is the server-to-server REST interface for Friendbuy''s referral and loyalty marketing platform. Merchants use it to sync customer records, generate personal referral links, track conversion events (purchases, sign-ups, and custom events), pull campaign analytics, and manage loyalty ledger balances and reward redemptions. The base URL is https://mapi.fbot.me/v1 (the fbot.me host is Friendbuy''s Merchant API origin). Authentication is a two-step flow: exchange an account key and secret at POST /authorization for a short-lived Bearer JWT, then send that token as `Authorization: Bearer ` on every subsequent request. Endpoint paths in this document are grounded in Friendbuy''s public developer documentation at developers.friendbuy.com. Request and response schemas are honestly modeled from the documented behavior and common Friendbuy payload fields; exact field-level shapes should be reconciled against the live reference before production use.' version: '1.0' contact: name: Friendbuy url: https://friendbuy.com license: name: Proprietary url: https://friendbuy.com/terms servers: - url: https://mapi.fbot.me/v1 description: Friendbuy Merchant API security: - bearerAuth: [] tags: - name: Customers description: Create and retrieve customer records and manage customer data requests. paths: /postCustomer: post: operationId: postCustomer tags: - Customers summary: Create or update a customer description: Creates or updates a Friendbuy customer record, keyed by your customer id and email. Used to sync your customer base so referrals and loyalty can be attributed. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CustomerInput' responses: '200': description: The created or updated customer. content: application/json: schema: $ref: '#/components/schemas/Customer' '401': $ref: '#/components/responses/Unauthorized' '422': $ref: '#/components/responses/ValidationError' /getCustomer: get: operationId: getCustomer tags: - Customers summary: Retrieve a customer description: Retrieves a customer record by customer id or email. parameters: - $ref: '#/components/parameters/CustomerId' - $ref: '#/components/parameters/Email' responses: '200': description: The requested customer. content: application/json: schema: $ref: '#/components/schemas/Customer' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /getMemberTierCustomer: get: operationId: getMemberTierCustomer tags: - Customers summary: Retrieve a customer's loyalty member tier description: Returns the loyalty program tier a customer currently belongs to. parameters: - $ref: '#/components/parameters/CustomerId' responses: '200': description: The customer's member tier. content: application/json: schema: type: object properties: customerId: type: string tier: type: string '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /getUserData: get: operationId: getUserData tags: - Customers summary: Request a customer's stored data (GDPR/CCPA) description: Returns the personal data Friendbuy stores for a customer, in support of GDPR/CCPA data-access requests. parameters: - $ref: '#/components/parameters/CustomerId' - $ref: '#/components/parameters/Email' responses: '200': description: The stored user data. content: application/json: schema: type: object additionalProperties: true '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /deleteUserData: delete: operationId: deleteUserData tags: - Customers summary: Delete a customer's stored data (GDPR/CCPA) description: Deletes the personal data Friendbuy stores for a customer, in support of GDPR/CCPA erasure requests. parameters: - $ref: '#/components/parameters/CustomerId' - $ref: '#/components/parameters/Email' responses: '200': description: Deletion confirmation. content: application/json: schema: type: object properties: deleted: type: boolean '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: responses: ValidationError: description: The request payload failed validation. content: application/json: schema: $ref: '#/components/schemas/Error' NotFound: description: The requested resource was not found. content: application/json: schema: $ref: '#/components/schemas/Error' Unauthorized: description: Missing or invalid Bearer token. content: application/json: schema: $ref: '#/components/schemas/Error' parameters: Email: name: email in: query required: false description: The customer's email address. schema: type: string CustomerId: name: customerId in: query required: false description: Your identifier for the customer. schema: type: string schemas: Error: type: object properties: error: type: object properties: code: type: string message: type: string CustomerInput: type: object required: - id properties: id: type: string description: Your identifier for the customer. email: type: string firstName: type: string lastName: type: string isNewCustomer: type: boolean Customer: allOf: - $ref: '#/components/schemas/CustomerInput' - type: object properties: createdOn: type: string format: date-time securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT description: 'Bearer JWT obtained from POST /authorization by exchanging your account key and secret. Passed as `Authorization: Bearer `.'