openapi: 3.0.3 info: title: OpenCart REST Affiliates Shipping Methods 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: Shipping Methods description: Available shipping method retrieval and selection paths: /shipping_method: post: operationId: setShippingMethod summary: Set the shipping method for the order description: 'Stores the selected shipping method in the session. Requires customer and shipping address to be set, and that the cart has shippable items. ' tags: - Shipping Methods requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object required: - shipping_method properties: api_token: type: string shipping_method: $ref: '#/components/schemas/ShippingMethodInput' responses: '200': description: Shipping method set or error content: application/json: schema: oneOf: - $ref: '#/components/schemas/SuccessResponse' - $ref: '#/components/schemas/ErrorResponse' /shipping_method/getShippingMethods: get: operationId: getShippingMethods summary: Retrieve available shipping methods description: 'Returns the list of available shipping methods for the current session. Requires customer data and a shipping address to be set. ' tags: - Shipping Methods parameters: - $ref: '#/components/parameters/ApiToken' responses: '200': description: Available shipping methods or error content: application/json: schema: oneOf: - type: object properties: shipping_methods: type: array items: $ref: '#/components/schemas/ShippingMethod' - $ref: '#/components/schemas/ErrorResponse' components: parameters: ApiToken: name: api_token in: query required: true schema: type: string description: Session token from the login endpoint schemas: ShippingMethodInput: type: object required: - name - code - cost - tax_class_id properties: name: type: string description: Human-readable name of the shipping method example: Flat Shipping Rate code: type: string description: Machine code of the shipping method example: flat.flat cost: type: number format: float description: Shipping cost (pre-tax) example: 5.0 tax_class_id: type: integer description: Tax class applied to shipping cost example: 9 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!' ShippingMethod: type: object properties: title: type: string example: Flat Shipping Rate quote: type: object additionalProperties: type: object properties: code: type: string name: type: string cost: type: number format: float tax_class_id: type: integer text: type: string sort_order: type: integer error: type: string 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