Avochato API


Welcome!

If anything isn’t working as documented, please message Avochato Support @ 415-214-8977.

Accounts

Fetch Accounts

Using your auth id + secret you can fetch Accounts by subdomains

Endpoint

GET /v1/accounts/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Account subdomains to fetch
page Page to request

Request

Route

GET /v1/accounts/test-account,account_9?auth_id=v5D9RnM9VA&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=v5D9RnM9VA
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts/test-account,account_9?auth_id=v5D9RnM9VA&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 77fa403c-5e3b-4093-862a-e140c59e51c2
X-Runtime: 0.018636
Content-Length: 293

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "KRg80BL9j0",
        "subdomain": "account_9",
        "name": "Account 9",
        "phone": null,
        "created_at": "2019-04-23T15:34:07.835-07:00"
      },
      {
        "id": "qQR91V4Jge",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2019-04-23T15:34:07.846-07:00"
      }
    ]
  },
  "page": 1
}

List Accounts

Using your auth id + secret you can list all your Accounts

Endpoint

GET /v1/accounts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
page Page to request

Request

Route

GET /v1/accounts?auth_id=xlYJpXGJmw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=xlYJpXGJmw
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts?auth_id=xlYJpXGJmw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 8504866f-4d73-4ffa-9979-feadcc1ab858
X-Runtime: 0.054499
Content-Length: 293

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "WAnJQrk8y1",
        "subdomain": "account_8",
        "name": "Account 8",
        "phone": null,
        "created_at": "2019-04-23T15:34:07.751-07:00"
      },
      {
        "id": "0nMJLQ78vZ",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2019-04-23T15:34:07.763-07:00"
      }
    ]
  },
  "page": 1
}

Broadcasts

Create Broadcast

Using your auth id + secret you can setup a broadcast

Endpoint

POST /v1/broadcasts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
message required Text to send in Broadcasts
media_url Url of media to send in MMS (500kb limit)
via_tags Comma-separated list of contact tags to add to broadcast
via_contact_ids Comma-separated list of contact ids to add to broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to broadcast
via_field[field] String, either name ,phone ,phone_formatted ,email ,company ,street ,city ,state ,country ,zip ,priority ,opted_out, OR Custom Variable name
via_field[value] String, match all contacts with a given field which matches this value exactly

Request

Route

POST /v1/broadcasts

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "wEG8jR58Ql",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty.jpg",
  "via_tags": "tag1,tag2",
  "via_contact_ids": "43y83Kk8VN",
  "via_phone_numbers": "5105551234,4155551234",
  "via_field[field]": "email",
  "via_field[value]": "bob@mctest.com"
}

cURL

curl "https://www.avochato.com/v1/broadcasts" -d '{"auth_id":"wEG8jR58Ql","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty.jpg","via_tags":"tag1,tag2","via_contact_ids":"43y83Kk8VN","via_phone_numbers":"5105551234,4155551234","via_field[field]":"email","via_field[value]":"bob@mctest.com"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 475b1019-aaa6-4dfe-8305-7c54ba78f418
X-Runtime: 0.083175
Content-Length: 278

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "xDjJBv1JoO",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty.jpg",
      "status": "initialized",
      "contacts_count": 0,
      "user": {
        "email": "person_6@example.com",
        "id": "3OLb4YR94Y",
        "name": "Person 7"
      },
      "pending_contacts_count": null
    }
  }
}

Fetch Broadcasts

Using your auth id + secret you can fetch broadcasts based on their ids

Endpoint

GET /v1/broadcasts/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to fetch
page Page number to request

Request

Route

GET /v1/broadcasts/43y833D8VN,wEG8jGYbQl?auth_id=GeAbZeX8DM&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=GeAbZeX8DM
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/broadcasts/43y833D8VN,wEG8jGYbQl?auth_id=GeAbZeX8DM&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 386d0233-4113-4423-bb67-0c1949282e42
X-Runtime: 0.062211
Content-Length: 337

Body

{
  "status": 200,
  "data": {
    "broadcasts": [
      {
        "id": "43y833D8VN",
        "message": "1",
        "status": "initialized",
        "contacts_count": 1,
        "user": {
          "email": "person_3@example.com",
          "id": "EDR8zKebA2",
          "name": "Person 4"
        }
      },
      {
        "id": "wEG8jGYbQl",
        "message": "2",
        "status": "queued",
        "contacts_count": 0,
        "user": {
          "email": "person_3@example.com",
          "id": "EDR8zKebA2",
          "name": "Person 4"
        }
      }
    ]
  }
}

Publish Broadcast

Using your auth id + secret you can publish your broadcast

Endpoint

POST /v1/broadcasts/:id/publish

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
schedule_for Unix timestamp, Ensure delivery at this time
asap Boolean, Ignore schedule_for and schedule ASAP

Request

Route

POST /v1/broadcasts/ZMvbXq49Rm/publish

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "43y83DdbVN",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "schedule_for": 1556022847.0769439,
  "asap": true
}

cURL

curl "https://www.avochato.com/v1/broadcasts/ZMvbXq49Rm/publish" -d '{"auth_id":"43y83DdbVN","auth_secret":"YYYYYYYYYYYYYYYYYYYY","schedule_for":1556022847.0769439,"asap":true}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 5d70f311-4670-4955-a64e-ed8434f9f78f
X-Runtime: 0.067607
Content-Length: 182

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "ZMvbXq49Rm",
      "message": "5",
      "status": "queued",
      "contacts_count": 1,
      "user": {
        "email": "person_5@example.com",
        "id": "Pe6beBR9Xw",
        "name": "Person 6"
      }
    }
  }
}

Update Broadcast

Using your auth id + secret you can add more contacts or update your broadcast

Endpoint

POST /v1/broadcasts/:id

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
message Text to send in Broadcasts
media_url Url of media to send in MMS (500kb limit)
via_tags Comma-separated list of contact tags to add to broadcast
via_contact_ids Comma-separated list of contact ids to add to broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to broadcast
via_field[field] String, [:name, :phone, :phone_formatted, :email, :company, :street, :city, :state, :country, :zip, :priority, :opted_out], OR Custom Variable name
via_field[value] String, match all contacts with a given field which matches this value exactly

Request

Route

POST /v1/broadcasts/xlYJp3m9mw

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "xoWbqmLbqn",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty2.jpg",
  "via_tags": "tag2,tag3",
  "via_contact_ids": "zPG9yYG9aO",
  "via_phone_numbers": "+15105551234,+14155551234",
  "via_field[field]": "email",
  "via_field[value]": "bob@mctest.com"
}

cURL

curl "https://www.avochato.com/v1/broadcasts/xlYJp3m9mw" -d '{"auth_id":"xoWbqmLbqn","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty2.jpg","via_tags":"tag2,tag3","via_contact_ids":"zPG9yYG9aO","via_phone_numbers":"+15105551234,+14155551234","via_field[field]":"email","via_field[value]":"bob@mctest.com"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: c8ddbd18-bcb4-429d-bd81-f92a973a7f7b
X-Runtime: 0.202350
Content-Length: 276

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "xlYJp3m9mw",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty2.jpg",
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_4@example.com",
        "id": "1K2b2Aj8WR",
        "name": "Person 5"
      },
      "pending_contacts_count": 3
    }
  }
}

CallTokens

Create Call Token

Using your auth id + secret you can create a token to make a call

Endpoint

POST /v1/calls

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field

Request

Route

POST /v1/calls

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "AEgb5y3bej",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY"
}

cURL

curl "https://www.avochato.com/v1/calls" -d '{"auth_id":"AEgb5y3bej","auth_secret":"YYYYYYYYYYYYYYYYYYYY"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 67b92233-af2f-4493-bd16-efadd360a14e
X-Runtime: 0.372708
Content-Length: 324

Body

{
  "status": 200,
  "data": {
    "call_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDpvdXRnb2luZz9hcHBTaWQ9bm90cmVhbCBzY29wZTpjbGllbnQ6aW5jb21pbmc_Y2xpZW50TmFtZT1WZVBKbDJPYmFyIiwiaXNzIjoidHdpbGlvX2FjY291bnRfc2lkIiwibmJmIjoxNTU2MDU4ODQ0LCJleHAiOjE1NTYxNDUyNDR9.7EfLWp2xfFj-bB8oD2lD0NqE4vWhCznNktohyXVPc4U"
  }
}

Contacts

Fetch Contacts

Using your auth id + secret you can fetch Contacts by ids

Endpoint

GET /v1/contacts/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to fetch
page Page to request

Request

Route

GET /v1/contacts/wd6JmN487m,ZMvbX3D8Rm?auth_id=0nMJLxNJvZ&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=0nMJLxNJvZ
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/contacts/wd6JmN487m,ZMvbX3D8Rm?auth_id=0nMJLxNJvZ&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 46d44e26-30aa-472b-b445-aa3c46c1aa4c
X-Runtime: 0.058380
Content-Length: 453

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "ZMvbX3D8Rm",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1556058849.618903,
        "tags": [
          "important"
        ]
      },
      {
        "id": "wd6JmN487m",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1556058849.62252
      }
    ]
  },
  "page": 1
}

Search Contacts

Using your auth id + secret you can search for matching Contacts based on a query

Endpoint

GET /v1/contacts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String to search Contacts with (default: iterate through all Contacts)
created_at[from] Select Contacts created after this unixtime
created_at[to] Select Contacts created before this unixtime (default: now)
page Page to request

Request

Route

GET /v1/contacts?auth_id=ZMvbXML9Rm&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1556058790.079249&created_at%5Bto%5D=1556058910.079299&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=ZMvbXML9Rm
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=name:Bob OR 'San Fran'
created_at%5Bfrom%5D=1556058790.079249
created_at%5Bto%5D=1556058910.079299
page=1

cURL

curl "https://www.avochato.com/v1/contacts?auth_id=ZMvbXML9Rm&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1556058790.079249&created_at%5Bto%5D=1556058910.079299&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 31f5dfb7-3860-4e4f-b32e-04ae425f07b8
X-Runtime: 0.025017
Content-Length: 433

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "2jRbkkXb1P",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1556058850.055251
      },
      {
        "id": "enL8a3w97N",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1556058850.058892
      }
    ]
  },
  "page": 1
}

Update Contact

Using your auth id + secret you can create or update a Contact based on their phone number

Endpoint

POST /v1/contacts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of Contact
name Name of the Contact
email Email for the Contact
other_phone Other phone for the Contact
company Company for the Contact
city City for the Contact
state State for the Contact
zip Zip Code for the Contact
country Country for the Contact
custom_variable_name Custom variable to set for the Contact
tags CSV of tags to apply to the Contact

Request

Route

POST /v1/contacts

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "KRg80oyJj0",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "email": "contact@example.com",
  "company": "Example Inc.",
  "city": "SF",
  "state": "CA",
  "country": "USA",
  "custom_variable_name": "value to set custom variable"
}

cURL

curl "https://www.avochato.com/v1/contacts" -d '{"auth_id":"KRg80oyJj0","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","email":"contact@example.com","company":"Example Inc.","city":"SF","state":"CA","country":"USA","custom_variable_name":"value to set custom variable"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 579f15e8-213b-48c3-b25c-3c164789564c
X-Runtime: 0.063274
Content-Length: 263

Body

{
  "status": 200,
  "data": {
    "contact": {
      "id": "xDjJB3m8oO",
      "name": "New Contact",
      "phone": "+14155553333",
      "email": "contact@example.com",
      "city": "SF",
      "state": "CA",
      "company": "Example Inc.",
      "created_at": 1556058849.8839428,
      "custom_variable_name": "value to set custom variable"
    }
  }
}

Events

Add Event (Contact id)

Using your auth id + secret you can append an Event directly into a Conversation stream based on the Contact id

Endpoint

POST /v1/contacts/:id/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Contact id to add an event to
type required Type of event to log: click, sale, etc.
context Context to save regarding the event
revenue Value created for your team from this event

Request

Route

POST /v1/contacts/BLP9M3Z8qY/events

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "VePJlG69ar",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "type": "sale",
  "context": "Wanted a new watch ($99.99) with no warranty",
  "revenue": 99.99
}

cURL

curl "https://www.avochato.com/v1/contacts/BLP9M3Z8qY/events" -d '{"auth_id":"VePJlG69ar","auth_secret":"YYYYYYYYYYYYYYYYYYYY","type":"sale","context":"Wanted a new watch ($99.99) with no warranty","revenue":99.99}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 859d92ca-aed8-4c60-9e8b-fd35677a54c7
X-Runtime: 0.073539
Content-Length: 303

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "2jRbkLe91P",
      "account_id": "z1N8xr3937",
      "ticket_id": "BDr8GRmJPl",
      "contact_id": "BLP9M3Z8qY",
      "type": "sale",
      "context": "Wanted a new watch ($99.99) with no warranty",
      "revenue": 99.99,
      "element_id": "GeAbZ39DMK",
      "element_type": "CustomEvent",
      "sent_at": 1556058850.760853
    }
  }
}

Add Event (Phone)

Using your auth id + secret you can append an Event directly into a Conversation stream based on the phone number

Endpoint

POST /v1/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of the Contact
type required Type of event to log: click, sale, etc.
context Context to save regarding the event
revenue Value created for your team from this event

Request

Route

POST /v1/events

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "wd6JmrA87m",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "type": "sale",
  "context": "Bought an avocado ($2) and was interested in a subscription",
  "revenue": 2.0
}

cURL

curl "https://www.avochato.com/v1/events" -d '{"auth_id":"wd6JmrA87m","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15551234567","type":"sale","context":"Bought an avocado ($2) and was interested in a subscription","revenue":2.0}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 46df9879-c740-47f7-85df-b18b423d9471
X-Runtime: 0.212398
Content-Length: 317

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "xDjJBml9oO",
      "account_id": "v7Mb6v7bER",
      "ticket_id": "z1N8xr3937",
      "contact_id": "PxB9N3BJYO",
      "type": "sale",
      "context": "Bought an avocado ($2) and was interested in a subscription",
      "revenue": 2.0,
      "element_id": "Pwebo1JXmD",
      "element_type": "CustomEvent",
      "sent_at": 1556058850.4048908
    }
  }
}

Add Event (Ticket id)

Using your auth id + secret you can append an Event directly into a Conversation stream based on the Ticket id

Endpoint

POST /v1/tickets/:id/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Ticket id to add event to
type required Type of event to log: click, sale, etc.
context Context to save regarding the event
revenue Value created for your team from this event

Request

Route

POST /v1/tickets/EDR8zE3JA2/events

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "ezjJ7o7J5y",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "type": "sale",
  "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
  "revenue": 15.5
}

cURL

curl "https://www.avochato.com/v1/tickets/EDR8zE3JA2/events" -d '{"auth_id":"ezjJ7o7J5y","auth_secret":"YYYYYYYYYYYYYYYYYYYY","type":"sale","context":"Wanted one hat ($10) and upsold warranty ($5.50)","revenue":15.5}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: b6a3d01d-8df0-45ba-8228-83a0414cab09
X-Runtime: 0.075460
Content-Length: 306

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "enL8aXOJ7N",
      "account_id": "BDr8GRmJPl",
      "ticket_id": "EDR8zE3JA2",
      "contact_id": "WAnJQ3Yby1",
      "type": "sale",
      "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
      "revenue": 15.5,
      "element_id": "xoWbqYbqnB",
      "element_type": "CustomEvent",
      "sent_at": 1556058851.004501
    }
  }
}

Fetch Events

Using your auth id + secret you can fetch Events in a Ticket based on Ticket ids

Endpoint

GET /v1/tickets/:ids/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Ticket ids to fetch the event stream
page Page to request

Request

Route

GET /v1/tickets/1K2b2Ew8WR/events?auth_id=xDjJBod8oO&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=xDjJBod8oO
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/1K2b2Ew8WR/events?auth_id=xDjJBod8oO&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 6f9818b2-1fd9-476b-9a90-2977cbbd4fdf
X-Runtime: 0.035242
Content-Length: 1744

Body

{
  "status": 200,
  "data": {
    "events": [
      {
        "account_id": "EDR8zE3JA2",
        "ticket_id": "1K2b2Ew8WR",
        "user_id": "PxB9NwxJYO",
        "status": "Closed",
        "element_id": "qQR91xVbge",
        "element_type": "StatusChange",
        "sent_at": 1556058851.236711
      },
      {
        "account_id": "EDR8zE3JA2",
        "call_from": "+15551234567",
        "call_to": "+15558888888",
        "voicemail": null,
        "direction": "in",
        "call_status": "completed",
        "ended_at": null,
        "duration": 119,
        "segments": 2,
        "element_id": "xoWbqMWbqn",
        "element_type": "Call",
        "sent_at": 1556058851.232917
      },
      {
        "uuid": "8a466d38-ddf6-40d5-b367-0a01af078ea5",
        "account_id": "EDR8zE3JA2",
        "contact_id": "0nMJL339vZ",
        "ticket_id": "1K2b2Ew8WR",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Sorry in a meeting but can call afterwards",
        "element_id": "ezjJ7V095y",
        "element_type": "SmsMessage",
        "sent_at": 1556058851.228524
      },
      {
        "uuid": "aa3ee310-98b4-4bae-908d-25713a823d0c",
        "account_id": "EDR8zE3JA2",
        "contact_id": "0nMJL339vZ",
        "ticket_id": "1K2b2Ew8WR",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Hey there Bob let me know when we can talk!",
        "element_id": "VePJleN8ar",
        "element_type": "SmsMessage",
        "sent_at": 1556058851.224113
      },
      {
        "account_id": "EDR8zE3JA2",
        "call_from": "+15558888888",
        "call_to": "+15551234567",
        "voicemail": null,
        "direction": "out",
        "call_status": "completed",
        "ended_at": null,
        "duration": 10,
        "segments": 1,
        "element_id": "GeAbZ1L8DM",
        "element_type": "Call",
        "sent_at": 1556058851.219535
      },
      {
        "account_id": "EDR8zE3JA2",
        "ticket_id": "1K2b2Ew8WR",
        "user_id": "PxB9NwxJYO",
        "status": "Open",
        "element_id": "KRg80gBJj0",
        "element_type": "StatusChange",
        "sent_at": 1556058851.215047
      },
      {
        "account_id": "EDR8zE3JA2",
        "ticket_id": "1K2b2Ew8WR",
        "user_id": "PxB9NwxJYO",
        "owner_id": "PxB9NwxJYO",
        "element_id": "AwebYqobaE",
        "element_type": "OwnerChange",
        "sent_at": 1556058851.210572
      }
    ]
  }
}

Messages

Search Messages

Using your auth id + secret you can search for matching Messages based on a query

Endpoint

GET /v1/messages

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String to search Messages for (default: iterate through all messages)
page Page to request
direction String, Direction of the message ("in" for received messages, "out" for sent messages)
status String, Message delivery status (queued, delivered, undelivered, failed)
created_at[from] Unix timestamp, Select contacts created after this date
created_at[to] Unix timestamp, Select contacts created before this date (default: now)

Request

Route

GET /v1/messages?auth_id=wd6Jm3Lb7m&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1556058788.014685&created_at%5Bto%5D=1556058908.014723

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=wd6Jm3Lb7m
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=in
status=delivered
created_at%5Bfrom%5D=1556058788.014685
created_at%5Bto%5D=1556058908.014723

cURL

curl "https://www.avochato.com/v1/messages?auth_id=wd6Jm3Lb7m&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1556058788.014685&created_at%5Bto%5D=1556058908.014723" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 72850c07-5398-4a02-882b-28956bae0567
X-Runtime: 0.073419
Content-Length: 402

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "9fcbf67a-8644-40ae-add4-d2ee59535dd1",
        "account_id": "M3NbrMz8r6",
        "contact_id": "v5D9R3yJVA",
        "ticket_id": "1LxJDLWJn2",
        "sender": "+15551234567",
        "direction": "in",
        "status": "delivered",
        "error_code": 0,
        "segments": 1,
        "message": "I kept hearing that you had great service 😀!",
        "element_id": "zPG9yez9aO",
        "element_type": "SmsMessage",
        "sent_at": 1556058848.013437
      }
    ]
  },
  "page": 1
}

Send Message

Using your auth id + secret you can send a Message to any Contact based on their phone

Endpoint

POST /v1/messages

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number to send
message required Text to send in SMS
from Phone number in the account to try to send from
media_url Url of media to send in MMS (500kb limit)
tags Comma-separated list of tags to apply to this contact
status_callback Domain to send callback http POST requests when the status is updated
tags CSV of tags to apply

Request

Route

POST /v1/messages

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "VePJl3a9ar",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "message": "test message",
  "from": "+15105551234",
  "tags": "Some Tag, Another Tag",
  "status_callback": "http://my.domain.com"
}

cURL

curl "https://www.avochato.com/v1/messages" -d '{"auth_id":"VePJl3a9ar","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","message":"test message","from":"+15105551234","tags":"Some Tag, Another Tag","status_callback":"http://my.domain.com"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 02317ec9-7a52-4f2d-a0c9-fb5c63594886
X-Runtime: 0.110572
Content-Length: 439

Body

{
  "status": 200,
  "data": {
    "message": {
      "uuid": "ea6d1d48-f978-45cf-9420-50385df07435",
      "account_id": "k5V9VKmJlr",
      "contact_id": "ezjJ7z395y",
      "ticket_id": "v7Mb6v7bER",
      "sender": "Test User",
      "direction": "out",
      "status": "queued",
      "error_code": 0,
      "segments": 1,
      "carrier": "twilio",
      "message": "test message",
      "content_type": "text/plain",
      "status_callback": "http://my.domain.com",
      "element_id": "xoWbqegbqn",
      "element_type": "SmsMessage",
      "sent_at": 1556058848.1822379
    }
  }
}

Tags

Add Tag (Contact id)

Using your auth id + secret you can add a new tag to Contacts

Endpoint

POST /v1/contacts/:ids/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to tag
tag required Tag to add to Contacts

Request

Route

POST /v1/contacts/KRg80Dz8j0,0nMJL3p9vZ/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "enL8avOb7N",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "tag": "my-new-tag"
}

cURL

curl "https://www.avochato.com/v1/contacts/KRg80Dz8j0,0nMJL3p9vZ/tags" -d '{"auth_id":"enL8avOb7N","auth_secret":"YYYYYYYYYYYYYYYYYYYY","tag":"my-new-tag"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: f45dd704-7525-42f3-99ac-34b4e11b7c9a
X-Runtime: 0.039515
Content-Length: 94

Body

{
  "status": 200,
  "data": {
    "action": "tagged",
    "tag": "my-new-tag",
    "ids": [
      "KRg80Dz8j0",
      "0nMJL3p9vZ"
    ]
  }
}

Add Tag (Phone)

Using your auth id + secret you can add a new tag to a Contact based on phone number

Endpoint

POST /v1/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of the Contact
tag required Tag to add to Contacts

Request

Route

POST /v1/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "ezjJ7wXJ5y",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-new-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"ezjJ7wXJ5y","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15551234567","tag":"my-new-tag"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 9840af63-b183-4531-b76f-f5181298701d
X-Runtime: 0.074830
Content-Length: 81

Body

{
  "status": 200,
  "data": {
    "action": "tagged",
    "tag": "my-new-tag",
    "ids": [
      "xDjJB3L8oO"
    ]
  }
}

Remove Tag (Contact id)

Using your auth id + secret you can remove an old tag from Contacts

Endpoint

DELETE /v1/contacts/:ids/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to untag
tag required Tag to remove from Contacts

Request

Route

DELETE /v1/contacts/PxB9N30JYO,enL8a3d97N/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "xDjJBdlboO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "tag": "my-old-tag"
}

cURL

curl "https://www.avochato.com/v1/contacts/PxB9N30JYO,enL8a3d97N/tags" -d '{"auth_id":"xDjJBdlboO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","tag":"my-old-tag"}' -X DELETE \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: edcebf58-dc3b-4145-9b8c-6b2c762ecd16
X-Runtime: 0.045403
Content-Length: 96

Body

{
  "status": 200,
  "data": {
    "action": "untagged",
    "tag": "my-old-tag",
    "ids": [
      "PxB9N30JYO",
      "enL8a3d97N"
    ]
  }
}

Remove Tag (Phone)

Using your auth id + secret you can remove an old tag from a Contact based on phone number

Endpoint

DELETE /v1/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of the Contact
tag required Tag to remove from Contacts

Request

Route

DELETE /v1/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "2jRbk3eb1P",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-old-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"2jRbk3eb1P","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15551234567","tag":"my-old-tag"}' -X DELETE \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 512ef2e3-87ba-4672-b7a6-88afe21022d5
X-Runtime: 0.038915
Content-Length: 83

Body

{
  "status": 200,
  "data": {
    "action": "untagged",
    "tag": "my-old-tag",
    "ids": [
      "BLP9M3Y8qY"
    ]
  }
}

Tickets

Fetch Tickets

Using your auth id + secret you can fetch Tickets by ids

Endpoint

GET /v1/tickets/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Ticket ids
page Page to request

Request

Route

GET /v1/tickets/3YnbgKRbae,RkAJv1a90o?auth_id=Pwebo34bXm&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=Pwebo34bXm
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/3YnbgKRbae,RkAJv1a90o?auth_id=Pwebo34bXm&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: db31887e-c97a-4a54-ad21-3400c9f43270
X-Runtime: 0.020588
Content-Length: 362

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "415cad5a-de5c-40a9-8094-e7c0da3fb0fe",
        "contact": "mQL9W3B9Wq",
        "user_id": "BDr8GaV9Pl",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1556058845.893384
      },
      {
        "uuid": "f33aa072-2c97-4b65-a476-47d43b2ba714",
        "contact": "EZA9P3xbrw",
        "user_id": null,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1556058845.8851972
      }
    ]
  },
  "page": 1
}

Search Tickets

Using your auth id + secret you can search for matching Tickets based on a query

Endpoint

GET /v1/tickets

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String to search Tickets with (default: iterate through all tickets)
page Page to request

Request

Route

GET /v1/tickets?auth_id=zPG9yGq8aO&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=zPG9yGq8aO
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=status:Open
page=1

cURL

curl "https://www.avochato.com/v1/tickets?auth_id=zPG9yGq8aO&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: f3e447e3-3fba-4342-9e4e-3a25cc415fc1
X-Runtime: 0.073232
Content-Length: 205

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "f4b7de0a-026e-4fe0-b595-4dc81beeb0a6",
        "contact": "3OLb462J4Y",
        "user_id": "z1N8xnj937",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1556058845.050835
      }
    ]
  },
  "page": 1
}