openapi: 3.0.1 info: title: Thinkific Admin Bundles Promotions API description: Thinkific's public API can be used to integrate your application with your Thinkific site. termsOfService: https://www.thinkific.com/legal/ contact: email: developers@thinkific.com version: v1 servers: - url: https://api.thinkific.com/api/public/v1 security: - OAuthAccessToken: [] - ApiKey: [] ApiKeySubdomain: [] tags: - name: Promotions description: Promotions operations paths: /promotions: get: tags: - Promotions summary: List promotions operationId: getPromotions parameters: - name: page in: query description: The page within the collection to fetch schema: type: number default: 1.0 - name: limit in: query description: The number of items to be returned schema: type: number default: 25.0 responses: 200: description: Promotions response content: application/json: schema: $ref: '#/components/schemas/GetPromotionsResponse' 403: $ref: '#/components/responses/ErrorForbiddenAppsNotAvailableResponse' post: tags: - Promotions summary: Create a new promotion operationId: createPromotion requestBody: description: New Promotion parameters content: application/json: schema: $ref: '#/components/schemas/PromotionRequest' required: false responses: 201: description: Promotions response content: application/json: schema: $ref: '#/components/schemas/PromotionResponse' 403: $ref: '#/components/responses/ErrorForbiddenAppsNotAvailableResponse' 422: description: Unprocessable Entity content: application/json: schema: $ref: '#/components/schemas/UnprocessableEntityError' example: errors: name: - can't be blank x-codegen-request-body-name: body /promotions/{id}: get: tags: - Promotions summary: Get promotion by provided ID operationId: getPromotionByID parameters: - name: id in: path description: Id of the promotion in the form of an integer required: true schema: type: number responses: 200: description: Promotions response content: application/json: schema: $ref: '#/components/schemas/PromotionResponse' 403: $ref: '#/components/responses/ErrorForbiddenAppsNotAvailableResponse' 404: description: Not Found content: application/json: schema: $ref: '#/components/schemas/ErrorNotFound' put: tags: - Promotions summary: Update promotion by provided ID operationId: updatePromotionByID parameters: - name: id in: path description: Id of the promotion in the form of an integer required: true schema: type: number requestBody: description: Promotion attributes content: application/json: schema: $ref: '#/components/schemas/PromotionRequest' required: false responses: 204: description: Promotion Updated 403: $ref: '#/components/responses/ErrorForbiddenAppsNotAvailableResponse' 404: description: Not Found content: application/json: schema: $ref: '#/components/schemas/ErrorNotFound' 422: description: Unprocessable Entity content: application/json: schema: $ref: '#/components/schemas/UnprocessableEntityError' example: errors: name: - can't be blank x-codegen-request-body-name: body delete: tags: - Promotions summary: Delete promotion by provided ID operationId: deletePromotionByID parameters: - name: id in: path description: Id of the promotion in the form of an integer required: true schema: type: number responses: 204: description: Promotions deleted 403: $ref: '#/components/responses/ErrorForbiddenAppsNotAvailableResponse' 404: description: Not Found content: application/json: schema: $ref: '#/components/schemas/ErrorNotFound' /promotions/by_coupon: get: tags: - Promotions summary: Get Promotion associated with the provided Coupon code. description: Find a Promotion by Coupon Code and Product parameters: - name: product_id in: query description: The id of the Product to which the promotion applies. required: true schema: type: number - name: coupon_code in: query description: The Coupon code to be used as search critieria. required: true schema: type: string responses: 200: description: Promotions response content: application/json: schema: $ref: '#/components/schemas/PromotionResponse' 403: $ref: '#/components/responses/ErrorForbiddenAppsNotAvailableResponse' 404: description: Not Found content: application/json: schema: $ref: '#/components/schemas/ErrorNotFound' components: schemas: PromotionResponse: type: object properties: id: type: number description: The ID of the Promotion as an integer. example: 1.0 name: type: string description: The name of the Promotion. example: A Promo description: type: string description: A description for the Promotion. example: The promo description starts_at: type: string description: The date and time when the Promotion begins. format: date-time example: '2018-01-01T01:01:00Z' expires_at: type: string description: The date and time when the Promotion ends. format: date-time example: '2018-01-31T01:01:00Z' discount_type: type: string description: The type of discount. Must be either 'fixed' or 'percentage'. enum: - fixed - percentage example: fixed amount: type: number description: The amount of the discount. If 'fixed', must be a dollar value. If 'percentage', must be a number greater than 0 and less than or equal to 100. example: 10.0 coupon_ids: type: array description: The coupon ids related to the promotion. example: - 1 - 2 - 3 items: type: number duration: type: number description: The duration for which the Promotion is applied. ** This value only applies to Promotions set on Products that are set as subscriptions or Payment Plans. ** example: 3.0 ValidationError: type: object properties: field_name: type: string description: validation error Meta: type: object properties: pagination: $ref: '#/components/schemas/Pagination' GetPromotionsResponse: required: - items - meta type: object properties: items: type: array items: $ref: '#/components/schemas/PromotionResponse' meta: $ref: '#/components/schemas/Meta' PromotionRequest: required: - amount - discount_type - name type: object properties: name: type: string description: The name of the Promotion. example: A Promo description: type: string description: A description for the Promotion. example: The promo description starts_at: type: string description: The date and time when the Promotion begins. format: date-time example: '2018-01-01T01:01:00Z' expires_at: type: string description: The date and time when the Promotion ends. format: date-time example: '2018-01-31T01:01:00Z' discount_type: type: string description: The type of discount. Must be either 'fixed' or 'percentage'. enum: - fixed - percentage example: fixed amount: type: number description: The amount of the discount. If 'fixed', must be a dollar value. If 'percentage', must be a number greater than 0 and less than or equal to 100. example: 10.0 product_ids: type: array description: The Products to apply the Promotion to. If none are specified, the Promotion is applicable to all Products. items: type: number coupon_ids: type: array description: The coupon ids related to the promotion. example: - 1 - 2 - 3 items: type: number duration: type: number description: The duration for which the Promotion is applied. ** This value only applies to Promotions set on Products that are set as subscriptions or Payment Plans. ** example: 3.0 ErrorForbiddenAppsNotAvailable: type: object properties: error: type: string description: access forbidden example: error: Access to Apps is not available on your plan. Upgrade to gain access ErrorNotFound: type: object properties: error: type: string description: item not found error example: error: Record not found. UnprocessableEntityError: type: object properties: errors: type: array items: $ref: '#/components/schemas/ValidationError' Pagination: type: object properties: current_page: type: number description: Current page number example: 1.0 next_page: type: number description: Next page number example: 2.0 prev_page: type: number description: Previous page number total_pages: type: number description: Number of total pages example: 10.0 total_items: type: number description: Number of total items example: 250.0 entries_info: type: string description: Entries info example: 1-10 of 10 description: Pagination metadata responses: ErrorForbiddenAppsNotAvailableResponse: description: Access Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorForbiddenAppsNotAvailable' securitySchemes: OAuthAccessToken: type: http scheme: bearer ApiKey: type: apiKey in: header name: X-Auth-API-Key description: Used together with ApiKeySubdomain ApiKeySubdomain: type: apiKey in: header name: X-Auth-Subdomain description: Used together with ApiKey externalDocs: description: Find out more about Thinkifc's API url: http://developers.thinkific.com/api/api-documentation/