Creed gifts API

The gifts API from Creed — 3 operation(s) for gifts.

OpenAPI Specification

creed-gifts-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Creed achievements gifts API
  description: Creed API - Christian AI Chatbot
  version: 1.0.0
tags:
- name: gifts
paths:
  /api/gifts/code:
    post:
      tags:
      - gifts
      summary: Create Gift Code
      description: "Create a new gift code for the authenticated user.\n\nThis endpoint creates a gift code that can be shared with others.\nThe gift code grants 1 year of premium access when redeemed.\n\nArgs:\n    request: CreateGiftCodeRequest with RevenueCat product and purchase IDs\n\nReturns:\n    CreateGiftCodeResponse with the generated gift code"
      operationId: create_gift_code_api_gifts_code_post
      security:
      - HTTPBearer: []
      parameters:
      - name: x-user-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-User-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGiftCodeRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateGiftCodeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/gifts/my-codes:
    get:
      tags:
      - gifts
      summary: Get My Gift Codes
      description: "Get all gift codes created by the authenticated user.\n\nThis endpoint returns a list of all gift codes the user has created,\nincluding their redemption status.\n\nReturns:\n    MyGiftCodesResponse with list of gift codes and counts"
      operationId: get_my_gift_codes_api_gifts_my_codes_get
      security:
      - HTTPBearer: []
      parameters:
      - name: x-user-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-User-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MyGiftCodesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/gifts/redeem:
    post:
      tags:
      - gifts
      summary: Redeem Gift Code
      description: "Redeem a gift code to receive 1 year of premium access.\n\nThe premium access is stacked on top of any existing subscription.\nUsers cannot redeem their own gift codes.\n\nArgs:\n    request: RedeemGiftCodeRequest with the gift code\n\nReturns:\n    RedeemGiftCodeResponse with success status and message"
      operationId: redeem_gift_code_api_gifts_redeem_post
      security:
      - HTTPBearer: []
      parameters:
      - name: x-user-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-User-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RedeemGiftCodeRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RedeemGiftCodeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MyGiftCodesResponse:
      properties:
        success:
          type: boolean
          title: Success
        gift_codes:
          items:
            $ref: '#/components/schemas/GiftCodeRecord'
          type: array
          title: Gift Codes
        total_count:
          type: integer
          title: Total Count
        redeemed_count:
          type: integer
          title: Redeemed Count
        unredeemed_count:
          type: integer
          title: Unredeemed Count
      type: object
      required:
      - success
      - gift_codes
      - total_count
      - redeemed_count
      - unredeemed_count
      title: MyGiftCodesResponse
      description: Response model for getting user's gift codes
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    RedeemGiftCodeResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether the redemption was successful
        message:
          type: string
          title: Message
          description: Success or error message
      type: object
      required:
      - success
      - message
      title: RedeemGiftCodeResponse
      description: Response model for redeeming a gift code
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RedeemGiftCodeRequest:
      properties:
        code:
          type: string
          minLength: 1
          title: Code
          description: The gift code to redeem
      type: object
      required:
      - code
      title: RedeemGiftCodeRequest
      description: Request model for redeeming a gift code
    CreateGiftCodeRequest:
      properties:
        rc_product:
          type: string
          minLength: 1
          title: Rc Product
          description: RevenueCat product ID
        rc_transaction:
          type: string
          minLength: 1
          title: Rc Transaction
          description: RevenueCat transaction ID
      type: object
      required:
      - rc_product
      - rc_transaction
      title: CreateGiftCodeRequest
      description: Request model for creating a gift code
    CreateGiftCodeResponse:
      properties:
        success:
          type: boolean
          title: Success
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
      - success
      - code
      - message
      title: CreateGiftCodeResponse
      description: Response model for creating a gift code
    GiftCodeRecord:
      properties:
        code:
          type: string
          title: Code
        buyer_id:
          type: string
          title: Buyer Id
        receiver_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Receiver Id
        rc_product:
          type: string
          title: Rc Product
        rc_transaction:
          type: string
          title: Rc Transaction
        redeemed:
          type: boolean
          title: Redeemed
        redeemed_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Redeemed At
        created_at:
          type: string
          title: Created At
      type: object
      required:
      - code
      - buyer_id
      - receiver_id
      - rc_product
      - rc_transaction
      - redeemed
      - redeemed_at
      - created_at
      title: GiftCodeRecord
      description: Model for a single gift code record
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Supabase JWT token