Rentle Discount Codes API

Discount code-related queries

OpenAPI Specification

rentle-discount-codes-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Twice Admin API Keys Discount Codes API
  description: API documentation for Twice Admin API
  version: '2023-02-01'
  contact: {}
  x-logo:
    url: https://firebasestorage.googleapis.com/v0/b/rentle-prod.appspot.com/o/logos%2Ftwice-logo-outline-black-padded.png?alt=media&token=c6731aba-03c9-4ce9-a9f0-a68478924fe0
servers:
- url: https://api.twicecommerce.com/admin
  description: Production API
tags:
- name: Discount Codes
  description: Discount code-related queries
paths:
  /discount-codes/{id}:
    get:
      operationId: discountCodes_get
      parameters:
      - name: id
        required: true
        in: path
        description: The id of the code to retrieve
        schema:
          type: string
      - name: x-rentle-version
        in: header
        description: API Version, e.g `2023-02-01`. See [versioning](/#tag/versioning) page for more details.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Discount code
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCodeDTO'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestExceptionDTO'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenExceptionDTO'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundExceptionDTO'
        '409':
          description: Conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictExceptionDTO'
        '429':
          description: Quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotaExceededExceptionDTO'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorExceptionDTO'
      summary: Get discount code
      tags:
      - Discount Codes
    delete:
      operationId: discountCodes_remove
      parameters:
      - name: id
        required: true
        in: path
        description: The id of the code to delete
        schema:
          type: string
      - name: x-rentle-version
        in: header
        description: API Version, e.g `2023-02-01`. See [versioning](/#tag/versioning) page for more details.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestExceptionDTO'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenExceptionDTO'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundExceptionDTO'
        '409':
          description: Conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictExceptionDTO'
        '429':
          description: Quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotaExceededExceptionDTO'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorExceptionDTO'
      summary: Delete discount code
      tags:
      - Discount Codes
  /discount-codes:
    get:
      operationId: discountCodes_list
      parameters:
      - name: limit
        required: false
        in: query
        description: How many objects to retrieve.
        schema:
          minimum: 1
          maximum: 100
          type: integer
      - name: pageToken
        required: false
        in: query
        description: Token to retrieve the next page of results. This is returned in the paged response.
        schema:
          minLength: 1
          type: string
      - name: x-rentle-version
        in: header
        description: API Version, e.g `2023-02-01`. See [versioning](/#tag/versioning) page for more details.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Paginated list of discount codes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedDiscountCodesDTO'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestExceptionDTO'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenExceptionDTO'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundExceptionDTO'
        '409':
          description: Conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictExceptionDTO'
        '429':
          description: Quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotaExceededExceptionDTO'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorExceptionDTO'
      summary: Get all discount codes
      tags:
      - Discount Codes
    post:
      operationId: discountCodes_create
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g `2023-02-01`. See [versioning](/#tag/versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDiscountCodeParameters'
      responses:
        '200':
          description: Discount code
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCodeDTO'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestExceptionDTO'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenExceptionDTO'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundExceptionDTO'
        '409':
          description: Conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictExceptionDTO'
        '429':
          description: Quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotaExceededExceptionDTO'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorExceptionDTO'
      summary: Create discount code
      tags:
      - Discount Codes
components:
  schemas:
    ConflictExceptionDTO:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              description: HTTP status code of the response.
              type: number
            code:
              description: Internal text code that represents the type of error.
              type: string
            message:
              description: Human-friendly description of the error
              type: string
            details:
              description: Details about errors in the request body
              type: array
              items:
                type: object
                properties:
                  path:
                    description: Path to the key in the request body, splitted by parts.
                    type: array
                    items:
                      type: string
                  message:
                    description: Specific errors in the value of the field.
                    type: string
                required:
                - path
                - message
          required:
          - status
          - code
          - message
      required:
      - error
      title: Conflict
      example:
        error:
          status: 409
          code: CONFLICT
          message: Conflict error
    CreateDiscountCodeParameters:
      type: object
      properties:
        code:
          description: The code that the customer can enter to get a discount.
          type: string
        priceRule:
          description: Discount code price rule.
          anyOf:
          - title: Percentage price rule
            example:
              type: percentage
              value: 50
            type: object
            properties:
              type:
                description: Discount is a percentage of the total price.
                type: string
                enum:
                - percentage
              value:
                description: Percentage value of the discount.
                type: integer
                minimum: 0
                maximum: 100
            required:
            - type
            - value
          - title: Fixed amount price rule
            example:
              type: fixed_amount
              value: 1000
            type: object
            properties:
              type:
                description: Discount is a fixed amount of the total price.
                type: string
                enum:
                - fixed_amount
              value:
                description: Amount of the discount, in minor units.
                type: integer
                minimum: 0
                maximum: 9007199254740991
            required:
            - type
            - value
        usageLimit:
          description: How many time the discount code can be used. If not set, usage has no limit.
          type: integer
          minimum: 0
          maximum: 9007199254740991
        validity:
          description: Validity details of the discount code.
          title: Discount code validity
          type: object
          properties:
            productIds:
              description: List of product IDs that the discount code is valid for.
              type: array
              items:
                type: string
            categoryIds:
              description: List of category IDs that the discount code is valid for.
              type: array
              items:
                type: string
            from:
              description: Code is valid for bookings created after this date.
              title: ISO 8601 date-time
              type: string
            to:
              description: Code is valid for bookings created before this date.
              title: ISO 8601 date-time
              type: string
            bookingStartDateFrom:
              description: Code is valid only for bookings that start after this date.
              title: ISO 8601 date-time
              type: string
            bookingStartDateTo:
              description: Code is valid only for bookings that start before this date.
              title: ISO 8601 date-time
              type: string
      required:
      - code
      - priceRule
    NotFoundExceptionDTO:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              description: HTTP status code of the response.
              type: number
            code:
              description: Internal text code that represents the type of error.
              type: string
            message:
              description: Human-friendly description of the error
              type: string
            details:
              description: Details about errors in the request body
              type: array
              items:
                type: object
                properties:
                  path:
                    description: Path to the key in the request body, splitted by parts.
                    type: array
                    items:
                      type: string
                  message:
                    description: Specific errors in the value of the field.
                    type: string
                required:
                - path
                - message
          required:
          - status
          - code
          - message
      required:
      - error
      title: Not Found
      example:
        error:
          status: 404
          code: NOT_FOUND
          message: Object not found
    QuotaExceededExceptionDTO:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              description: HTTP status code of the response.
              type: number
            code:
              description: Internal text code that represents the type of error.
              type: string
            message:
              description: Human-friendly description of the error
              type: string
            details:
              description: Details about errors in the request body
              type: array
              items:
                type: object
                properties:
                  path:
                    description: Path to the key in the request body, splitted by parts.
                    type: array
                    items:
                      type: string
                  message:
                    description: Specific errors in the value of the field.
                    type: string
                required:
                - path
                - message
          required:
          - status
          - code
          - message
      required:
      - error
      title: Quota Exceeded
      example:
        error:
          status: 429
          code: RATE_LIMIT_HIT
          message: Your API key has exceeded the rate limit. Please wait a moment before making new requests.
    DiscountCodeDTO:
      type: object
      properties:
        id:
          description: Unique identifier of the discount code.
          type: string
        code:
          description: The code that the customer can enter to get a discount.
          type: string
        priceRule:
          description: Discount code price rule.
          anyOf:
          - title: Percentage price rule
            example:
              type: percentage
              value: 50
            type: object
            properties:
              type:
                description: Discount is a percentage of the total price.
                type: string
                enum:
                - percentage
              value:
                description: Percentage value of the discount.
                type: integer
                minimum: 0
                maximum: 100
            required:
            - type
            - value
          - title: Fixed amount price rule
            example:
              type: fixed_amount
              value: 1000
            type: object
            properties:
              type:
                description: Discount is a fixed amount of the total price.
                type: string
                enum:
                - fixed_amount
              value:
                description: Amount of the discount, in minor units.
                type: integer
                minimum: 0
                maximum: 9007199254740991
            required:
            - type
            - value
        usageCount:
          description: How many times the discount code has been used.
          type: integer
          minimum: 0
          maximum: 9007199254740991
        usageLimit:
          description: How many time the discount code can be used. If not set, usage has no limit.
          type: integer
          minimum: 0
          maximum: 9007199254740991
        validity:
          description: Validity details of the discount code.
          title: Discount code validity
          type: object
          properties:
            productIds:
              description: List of product IDs that the discount code is valid for.
              type: array
              items:
                type: string
            categoryIds:
              description: List of category IDs that the discount code is valid for.
              type: array
              items:
                type: string
            from:
              description: Code is valid for bookings created after this date.
              title: ISO 8601 date-time
              type: string
            to:
              description: Code is valid for bookings created before this date.
              title: ISO 8601 date-time
              type: string
            bookingStartDateFrom:
              description: Code is valid only for bookings that start after this date.
              title: ISO 8601 date-time
              type: string
            bookingStartDateTo:
              description: Code is valid only for bookings that start before this date.
              title: ISO 8601 date-time
              type: string
      required:
      - id
      - code
      - priceRule
      - usageCount
      title: Discount code
      example:
        id: IjBfrZz4QqcTkzsOmjuZ
        code: SALE-10
        priceRule:
          type: percentage
          value: 10
        usageCount: 5
        usageLimit: 100
        validity:
          productIds:
          - tbwNN366EwmwKERBawOu
          - 8dLarLUajCNrUXpjtnl4
          categoryIds:
          - P4qlQd9tuIi5bVlpsLAU
          from: '2026-07-19T01:04:27.087Z'
          to: '2026-07-26T01:04:27.088Z'
          bookingStartDateFrom: '2026-08-19T01:04:27.088Z'
          bookingStartDateTo: '2026-08-26T01:04:27.089Z'
    ForbiddenExceptionDTO:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              description: HTTP status code of the response.
              type: number
            code:
              description: Internal text code that represents the type of error.
              type: string
            message:
              description: Human-friendly description of the error
              type: string
            details:
              description: Details about errors in the request body
              type: array
              items:
                type: object
                properties:
                  path:
                    description: Path to the key in the request body, splitted by parts.
                    type: array
                    items:
                      type: string
                  message:
                    description: Specific errors in the value of the field.
                    type: string
                required:
                - path
                - message
          required:
          - status
          - code
          - message
      required:
      - error
      title: Forbidden
      example:
        error:
          status: 403
          code: FORBIDDEN
          message: You are do not have permission to perform this action. The problem could be missing API scopes or an expired/invalid API token.
    BadRequestExceptionDTO:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              description: HTTP status code of the response.
              type: number
            code:
              description: Internal text code that represents the type of error.
              type: string
            message:
              description: Human-friendly description of the error
              type: string
            details:
              description: Details about errors in the request body
              type: array
              items:
                type: object
                properties:
                  path:
                    description: Path to the key in the request body, splitted by parts.
                    type: array
                    items:
                      type: string
                  message:
                    description: Specific errors in the value of the field.
                    type: string
                required:
                - path
                - message
          required:
          - status
          - code
          - message
      required:
      - error
      title: Bad Request
      example:
        error:
          status: 400
          code: INVALID_ARGUMENTS
          details:
          - path:
            - startDate
            message: Required
          - path:
            - duration
            message: Required
          message: Your request contained invalid arguments
    InternalServerErrorExceptionDTO:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              description: HTTP status code of the response.
              type: number
            code:
              description: Internal text code that represents the type of error.
              type: string
            message:
              description: Human-friendly description of the error
              type: string
            details:
              description: Details about errors in the request body
              type: array
              items:
                type: object
                properties:
                  path:
                    description: Path to the key in the request body, splitted by parts.
                    type: array
                    items:
                      type: string
                  message:
                    description: Specific errors in the value of the field.
                    type: string
                required:
                - path
                - message
          required:
          - status
          - code
          - message
      required:
      - error
      title: Internal Server Error
      example:
        error:
          status: 500
          code: INTERNAL_SERVER_ERROR
          message: An unexpected error occurred. Please try again later.
    PagedDiscountCodesDTO:
      type: object
      properties:
        data:
          description: List of returned resources
          type: array
          items:
            title: Discount code
            example:
              id: IjBfrZz4QqcTkzsOmjuZ
              code: SALE-10
              priceRule:
                type: percentage
                value: 10
              usageCount: 5
              usageLimit: 100
              validity:
                productIds:
                - tbwNN366EwmwKERBawOu
                - 8dLarLUajCNrUXpjtnl4
                categoryIds:
                - P4qlQd9tuIi5bVlpsLAU
                from: '2026-07-19T01:04:27.087Z'
                to: '2026-07-26T01:04:27.088Z'
                bookingStartDateFrom: '2026-08-19T01:04:27.088Z'
                bookingStartDateTo: '2026-08-26T01:04:27.089Z'
            type: object
            properties:
              id:
                description: Unique identifier of the discount code.
                type: string
              code:
                description: The code that the customer can enter to get a discount.
                type: string
              priceRule:
                description: Discount code price rule.
                anyOf:
                - title: Percentage price rule
                  example:
                    type: percentage
                    value: 50
                  type: object
                  properties:
                    type:
                      description: Discount is a percentage of the total price.
                      type: string
                      enum:
                      - percentage
                    value:
                      description: Percentage value of the discount.
                      type: integer
                      minimum: 0
                      maximum: 100
                  required:
                  - type
                  - value
                - title: Fixed amount price rule
                  example:
                    type: fixed_amount
                    value: 1000
                  type: object
                  properties:
                    type:
                      description: Discount is a fixed amount of the total price.
                      type: string
                      enum:
                      - fixed_amount
                    value:
                      description: Amount of the discount, in minor units.
                      type: integer
                      minimum: 0
                      maximum: 9007199254740991
                  required:
                  - type
                  - value
              usageCount:
                description: How many times the discount code has been used.
                type: integer
                minimum: 0
                maximum: 9007199254740991
              usageLimit:
                description: How many time the discount code can be used. If not set, usage has no limit.
                type: integer
                minimum: 0
                maximum: 9007199254740991
              validity:
                description: Validity details of the discount code.
                title: Discount code validity
                type: object
                properties:
                  productIds:
                    description: List of product IDs that the discount code is valid for.
                    type: array
                    items:
                      type: string
                  categoryIds:
                    description: List of category IDs that the discount code is valid for.
                    type: array
                    items:
                      type: string
                  from:
                    description: Code is valid for bookings created after this date.
                    title: ISO 8601 date-time
                    type: string
                  to:
                    description: Code is valid for bookings created before this date.
                    title: ISO 8601 date-time
                    type: string
                  bookingStartDateFrom:
                    description: Code is valid only for bookings that start after this date.
                    title: ISO 8601 date-time
                    type: string
                  bookingStartDateTo:
                    description: Code is valid only for bookings that start before this date.
                    title: ISO 8601 date-time
                    type: string
            required:
            - id
            - code
            - priceRule
            - usageCount
        count:
          description: Number of returned resources
          type: number
        total:
          description: Total number of resources
          type: number
        nextPageToken:
          description: This can be used in the next request to retrieve the next page of results.
          type: string
      required:
      - data
      - count
      - total
      title: Paginated list of discount codes
x-webhooks:
  productCreated:
    post:
      summary: Product created
      operationId: productCreated
      tags:
      - Product
      description: Occurs when a new product is created.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductWebhookDTO'
      responses:
        '200':
          description: Return 200 OK to indicate the data was received successfully
  productUpdated:
    post:
      summary: Product updated
      operationId: productUpdated
      tags:
      - Product
      description: Occurs when a product is updated.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductWebhookDTO'
      responses:
        '200':
          description: Return 200 OK to indicate the data was received successfully
  productDeleted:
    post:
      summary: Product deleted
      operationId: productDeleted
      tags:
      - Product
      description: Occurs when a product is deleted.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductWebhookDTO'
      responses:
        '200':
          description: Return 200 OK to indicate the data was received successfully
  orderCreated:
    post:
      summary: Order created
      operationId: orderCreated
      tags:
      - Order
      description: Occurs when a new order is created.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderWebhookDTO'
      responses:
        '200':
          description: Return 200 OK to indicate the data was received successfully
  orderUpdated:
    post:
      summary: Order updated
      operationId: orderUpdated
      tags:
      - Order
      description: Occurs when an order is updated.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderWebhookDTO'
      responses:
        '200':
          description: Return 200 OK to indicate the data was received successfully
  orderPrepared:
    post:
      summary: Order prepared
      operationId: orderPrepared
      tags:
      - Order
      description: Occurs when an order is marked as prepared.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more details.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderWebhookDTO'
      responses:
        '200':
          description: Return 200 OK to indicate the data was received successfully
  orderStarted:
    post:
      summary: Order started
      operationId: orderStarted
      tags:
      - Order
      description: Occurs when an order is started.
      parameters:
      - name: x-rentle-version
        in: header
        description: API Version, e.g '2023-02-01'. See [versioning](#tag/Versioning) page for more

# --- truncated at 32 KB (34 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/rentle/refs/heads/main/openapi/rentle-discount-codes-api-openapi.yml