Whippy Contacts API

Manage contacts and communication preferences.

OpenAPI Specification

whippy-contacts-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Whippy Public Campaigns Contacts API
  description: The Whippy Public API is a RESTful API for the Whippy AI customer communication platform. It uses standard HTTP methods and JSON request / response bodies and is authenticated with an API key supplied in the X-WHIPPY-KEY header (OAuth bearer tokens are also supported). The API covers messaging (SMS / MMS, email, fax), contacts, conversations and messages, campaigns, automated sequences, channels, and webhook / custom events.
  termsOfService: https://www.whippy.ai/terms-of-service
  contact:
    name: Whippy Support
    url: https://docs.whippy.ai
  version: '1.0'
servers:
- url: https://api.whippy.co/v1
  description: Whippy Public API v1
security:
- WhippyApiKey: []
tags:
- name: Contacts
  description: Manage contacts and communication preferences.
paths:
  /contacts:
    get:
      operationId: getContacts
      tags:
      - Contacts
      summary: List contacts
      parameters:
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: A page of contacts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createContact
      tags:
      - Contacts
      summary: Create a contact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContactRequest'
      responses:
        '201':
          description: Contact created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /contacts/{id}:
    parameters:
    - $ref: '#/components/parameters/PathId'
    get:
      operationId: getContact
      tags:
      - Contacts
      summary: Show a contact
      responses:
        '200':
          description: A single contact
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
    put:
      operationId: updateContact
      tags:
      - Contacts
      summary: Update a contact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContactRequest'
      responses:
        '200':
          description: Contact updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
    delete:
      operationId: deleteContact
      tags:
      - Contacts
      summary: Delete a contact
      responses:
        '200':
          description: Contact deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
  /contacts/search:
    post:
      operationId: searchContacts
      tags:
      - Contacts
      summary: Search contacts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                phone:
                  type: string
                email:
                  type: string
                name:
                  type: string
                external_id:
                  type: string
                limit:
                  type: integer
                offset:
                  type: integer
      responses:
        '200':
          description: Matching contacts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactList'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /contacts/upsert:
    put:
      operationId: upsertContacts
      tags:
      - Contacts
      summary: Upsert contacts
      description: Create or update contacts keyed on phone / email / external_id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - contacts
              properties:
                contacts:
                  type: array
                  items:
                    $ref: '#/components/schemas/CreateContactRequest'
      responses:
        '202':
          description: Upsert accepted for processing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AcceptedResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /contacts/{id}/communication_preferences:
    parameters:
    - $ref: '#/components/parameters/PathId'
    get:
      operationId: getContactCommunicationPreferences
      tags:
      - Contacts
      summary: List a contact's communication preferences
      responses:
        '200':
          description: Communication preferences
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/CommunicationPreference'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /contacts/{id}/communication_preferences/opt_in:
    parameters:
    - $ref: '#/components/parameters/PathId'
    post:
      operationId: optInCommunicationPreference
      tags:
      - Contacts
      summary: Opt a contact into a channel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptPreferenceRequest'
      responses:
        '200':
          description: Opted in
        '401':
          $ref: '#/components/responses/Unauthorized'
  /contacts/{id}/communication_preferences/opt_out:
    parameters:
    - $ref: '#/components/parameters/PathId'
    post:
      operationId: optOutCommunicationPreference
      tags:
      - Contacts
      summary: Opt a contact out of a channel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptPreferenceRequest'
      responses:
        '200':
          description: Opted out
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  parameters:
    Limit:
      name: limit
      in: query
      description: Number of results per page (default 50, max 500).
      schema:
        type: integer
        default: 50
        maximum: 500
    Offset:
      name: offset
      in: query
      description: Number of results to skip for pagination.
      schema:
        type: integer
        default: 0
    PathId:
      name: id
      in: path
      required: true
      description: Resource UUID.
      schema:
        type: string
        format: uuid
  schemas:
    Address:
      type: object
      properties:
        address_line_one:
          type: string
        address_line_two:
          type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
        postal_code:
          type: string
    CreateContactRequest:
      type: object
      required:
      - phone
      properties:
        phone:
          type: string
        name:
          type: string
        email:
          type: string
        external_id:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        birth_date:
          $ref: '#/components/schemas/BirthDate'
        language:
          type: string
        default_channel_id:
          type: string
          format: uuid
        properties:
          type: object
          additionalProperties: true
        opt_in_to:
          type: array
          items:
            $ref: '#/components/schemas/OptInChannel'
        opt_in_to_all_channels:
          type: boolean
    Contact:
      type: object
      properties:
        id:
          type: string
          format: uuid
        phone:
          type: string
        email:
          type: string
        name:
          type: string
        external_id:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        birth_date:
          $ref: '#/components/schemas/BirthDate'
        state:
          type: string
          enum:
          - open
          - archived
          - blocked
        blocked:
          type: boolean
        communication_preferences:
          type: array
          items:
            $ref: '#/components/schemas/CommunicationPreference'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    OptInChannel:
      type: object
      properties:
        id:
          type: string
          format: uuid
        phone:
          type: string
    BirthDate:
      type: object
      properties:
        day:
          type: integer
        month:
          type: integer
        year:
          type: integer
    ContactResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Contact'
    OptPreferenceRequest:
      type: object
      properties:
        channel_id:
          type: string
          format: uuid
        phone:
          type: string
    ContactList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Contact'
        total:
          type: integer
    CommunicationPreference:
      type: object
      properties:
        channel_id:
          type: string
          format: uuid
        opt_in:
          type: boolean
        updated_at:
          type: string
          format: date-time
    AcceptedResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            message:
              type: string
    Error:
      type: object
      properties:
        error:
          type: string
        status:
          type: integer
  responses:
    Unauthorized:
      description: Not authenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    WhippyApiKey:
      type: apiKey
      in: header
      name: X-WHIPPY-KEY
      description: Organization API key. Generated in the Whippy app under Settings > Developers. OAuth 2.0 bearer tokens are also accepted via the Authorization header.