SnackMagic Automation management API

Automation related API endpoints

OpenAPI Specification

snackmagic-automation-management-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  description: "### *Stadium’s API can only be used by customers and partners on the Business and Enterprise Packages. See [here](https://www.bystadium.com/pricing) for more details.\n\n# Introduction\n\nStadium's API lets you embed a global gift, rewards, and branded swag catalog on your own native application.\n\nYou can also embed a unique treat link to send Stadium Shop points for your users to redeem gifts, rewards and swag, on Stadium.\n\n- Pull in and display your unique Stadium Shop products.\n- Place orders against your Stadium Shop from your website or app, and pass on fulfillment to Stadium.\n- Send Stadium Shop points via our secure treat link for users to redeem gifts, rewards and branded swag to your branded Stadium Shop, on Stadium. This replicates our send points flow without having to generate an admin/organizer order from Stadium.\n\n# Getting started\n\nTo start using the API, you'll need to set up a shop against which you would be placing orders.\n\nTo set up a shop:\n\n1. Sign up for a **free** Stadium account at: https://www.bystadium.com/. See Login/Sign Up in the top right corner of the page.\n2. Create your **free** Stadium Shop signup for an account at **Stadium** and create as many shops as you desire. [Video demo link](https://youtu.be/VAMfQMHqVmY)\n3. Once you have set up the shop, edit your shop catalog on the Stadium Shop’s dashboard so that you curate and approve all SKUs you are making available from our master catalog. [Video demo link](https://youtu.be/DEY1N2bBYtw)\n4. Set up your funding source. Because there will be no checkout page to pay for orders on Stadium’s front-end website, API users must deposit Wallet funds which can be used as a pre-purchased balance to pay for orders every time a recipient redeems Stadium products on a third-party platform. [More details here](https://www.bystadium.com/wallet)\n5. Once you have created an account, set up your shop, finalized your catalog, and set up a funding source, reach out to our support at engineering@bystadium.com and we'll provide you with access credentials which can be used to generate tokens and make API requests.\n\n\n# Environments\n\nStadium's API has two environments:\n\n- **Production**\n  https://api.bystadium.com\n\n- **Sandbox**\n  https://api.preprod.bystadium.com\n\n\n# Sandbox\n\nYou can use the Sandbox environment to create test orders without being charged for them. Your sandbox account\nis entirely separate account from production, so you can do your testing without affecting your main account.\n\nTo setup a sandbox account, please email engineering@bystadium.com for basic credentials. Once you receive those\nto access the sandbox environment, you can create a test user account and Stadium Shop by signing up on\nhttps://preprod.bystadium.com/shops/all\n\nOnce done, reach out to our support at engineering@bystadium.com and we’ll help you get started with API keys.\n"
  version: 2.0.0
  title: Stadium Authentication Automation management API
  termsOfService: https://www.bystadium.com/terms-of-use/
  contact:
    name: API Support
    email: engineering@bystadium.com
    url: https://www.bystadium.com
  x-logo:
    url: https://assets.auth0.bystadium.com/images/logos/color/stadium.svg
    altText: Stadium logo
servers:
- url: https://api.bystadium.com/api/v2
  description: Default server
- url: https://api.preprod.bystadium.com/api/v2
  description: Sandbox server
tags:
- name: Automation management
  description: Automation related API endpoints
paths:
  /automations/orders:
    post:
      tags:
      - Automation management
      summary: Create automation order
      description: 'Place order for webhook automation


        Each request will create a new order using the provided list of email addresses.<br/>

        You can check the status of your order using the identifier returned in the response.


        Please note that it may take up to 30 minutes to process the order.

        '
      operationId: createAutomationOrder
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createAutomationOrderResponse'
        '422':
          description: Error occurred while creating automation order
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '404':
          description: Automation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidApiKey'
      parameters:
      - name: api_key
        in: header
        required: true
        schema:
          type: string
        description: 'API key of the webhook automation eg: `ryfMiGzMp8ZTisWYbZUhjkVL`'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                contact_emails:
                  type: array
                  items:
                    type: string
                    format: email
                    description: Email of the recipient, e.g., `abc@example.com`
                recipient_message:
                  type: string
                  example: Happy Birthday!
                  description: This message is shown to the recipient at redemption. If no custom text is set, we will display the message configured during automation setup.
                sender_name:
                  type: string
                  example: John Doe
                  description: Name of the sender. If no name is provided, we will display the sender name configured during automation setup.
                budget:
                  type: number
                  example: 2500
                  description: Amount of points to be gifted. If no budget is provided, we will send the points budget configured during automation setup.
              required:
              - contact_emails
  /automations/order_status:
    get:
      tags:
      - Automation management
      summary: Check order status
      description: Check status for automation order
      operationId: checkOrderStatus
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckOrderStatusResponse'
        '422':
          description: Something went wrong, please try again later!
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderStatusApiErrorResponse'
        '404':
          description: Automation/Order not found.
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/InvalidApiKey'
                - $ref: '#/components/schemas/InvalidIdentifier'
      parameters:
      - name: api_key
        in: header
        required: true
        schema:
          type: string
        description: 'API key of the webhook automation eg: `ryfMiGzMp8ZTisWYbZUhjkVL`'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                order_identifier:
                  type: string
                  description: 'Identifier of the order associated eg: `qmfMiGzMp8ZTiyuwZUhjyuis`'
              required:
              - order_identifier
components:
  schemas:
    InvalidApiKey:
      type: object
      properties:
        errors:
          type: string
          description: Automation with the given API key does not exist
          example: We are unable to find automation with the given API key
    OrderStatusDetail:
      type: object
      properties:
        email:
          type: string
          example: abc@example.com
          description: email of recipient
        status:
          type: string
          example: success
          description: 'status of order: success|pending|enqueued|failed'
        order:
          type: object
          properties:
            data:
              type: object
              properties:
                id:
                  type: integer
                type:
                  type: string
                attributes:
                  type: object
                  properties:
                    number:
                      type: string
                    total:
                      type: integer
                    shipment_status:
                      type: string
                    completed_at:
                      type: string
                      format: date-time
                    products:
                      type: array
    OrderStatusApiErrorResponse:
      type: object
      properties:
        errors:
          type: string
          description: Something went wrong, please try again later!
          example: Something went wrong, please try again later!
    InvalidIdentifier:
      type: object
      properties:
        errors:
          type: string
          description: Automation with the given API key does not exist
          example: No order found for the given identifier
    createAutomationOrderDetail:
      type: object
      properties:
        email:
          type: string
          example: abc@example.com
          description: email of recipient
        status:
          type: string
          example: success
          description: 'status of order: success|pending|enqueued|failed'
        message:
          type: string
          example: Invalid email
    createAutomationOrderResponse:
      type: object
      properties:
        identifier:
          type: String
          example: ryfMiGzMp8ZTisWYbZUhjkVL
          description: To identify the associated automation order
        data:
          type: array
          items:
            $ref: '#/components/schemas/createAutomationOrderDetail'
    CheckOrderStatusResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/OrderStatusDetail'
    ApiErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: object
                properties:
                  pointer:
                    type: string
              detail:
                type: string
                description: Error Details
  securitySchemes:
    Token:
      type: http
      in: header
      scheme: bearer
      bearerFormat: JWT