openapi: 3.0.3 info: title: OpenCart REST Affiliates API description: 'The OpenCart REST API enables external applications to communicate with a self-hosted OpenCart store. It provides endpoints for managing the shopping cart, customers, orders, addresses, shipping methods, payment methods, subscriptions, and affiliates. Authentication is performed by submitting API credentials to receive a session token, which must accompany subsequent requests. IP-allowlist enforcement is applied at the store level. ' version: '4.0' contact: name: OpenCart Developer Documentation url: https://docs.opencart.com/developer/ license: name: GNU GPL v3 url: https://github.com/opencart/opencart/blob/master/LICENSE.md servers: - url: https://yourstore.com/index.php?route=api description: OpenCart store API base URL (replace yourstore.com with your store domain) security: - apiToken: [] tags: - name: Affiliates description: Affiliate session management paths: /affiliate: post: operationId: setAffiliate summary: Set affiliate for the current session description: 'Associates an affiliate with the current API session. Validates that the affiliate exists and that the order subtotal is valid. ' tags: - Affiliates requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: api_token: type: string affiliate_id: type: integer description: Affiliate ID (default 0 if not provided) example: 3 responses: '200': description: Affiliate set or error content: application/json: schema: oneOf: - $ref: '#/components/schemas/SuccessResponse' - $ref: '#/components/schemas/ErrorResponse' components: schemas: SuccessResponse: type: object properties: success: type: string description: Localised success message example: 'Success: You have modified your shopping cart!' ErrorResponse: type: object properties: error: type: string description: Localised error message example: 'Warning: Permission Denied!' securitySchemes: apiToken: type: apiKey in: query name: api_token description: Session token obtained from the /login endpoint externalDocs: description: OpenCart Admin API Documentation url: https://docs.opencart.com/admin-interface/system/users/api