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_18?auth_id=3OLb4KO84Y&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=3OLb4KO84Y
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts/test-account,account_18?auth_id=3OLb4KO84Y&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: 50695a2f-954e-4e85-9211-0b9a50fec9be
X-Runtime: 0.027854
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "ezjJ7OlJ5y",
        "subdomain": "account_18",
        "name": "Account 18",
        "phone": null,
        "created_at": "2018-07-02T15:53:10.970-07:00"
      },
      {
        "id": "xDjJB7V8oO",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2018-07-02T15:53:10.985-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=Pe6beDx8Xw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=Pe6beDx8Xw
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts?auth_id=Pe6beDx8Xw&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: d1e6310d-c870-4dfc-b7cc-ab100bb5157f
X-Runtime: 0.060792
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "wd6Jm7rb7m",
        "subdomain": "account_17",
        "name": "Account 17",
        "phone": null,
        "created_at": "2018-07-02T15:53:10.878-07:00"
      },
      {
        "id": "VePJlmD8ar",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2018-07-02T15:53:10.896-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

Request

Route

POST /v1/broadcasts

Headers

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

Body

{
  "auth_id": "3YnbgDg9ae",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty.jpg",
  "via_tags": "tag1,tag2",
  "via_contact_ids": "Dz9nVgA9e3",
  "via_phone_numbers": "5105551234,4155551234"
}

cURL

curl "https://www.avochato.com/v1/broadcasts" -d '{"auth_id":"3YnbgDg9ae","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty.jpg","via_tags":"tag1,tag2","via_contact_ids":"Dz9nVgA9e3","via_phone_numbers":"5105551234,4155551234"}' -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: 30c9aae4-2d5c-47e8-ac7d-55398c0a1ae2
X-Runtime: 0.060413
Content-Length: 248

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "VePJlnKbar",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty.jpg",
      "status": "initialized",
      "contacts_count": 0,
      "user": {
        "email": "person_5@example.com",
        "id": "3OLb4Pab4Y",
        "name": "Person 5"
      }
    }
  }
}

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/ezjJ7d185y,xDjJBR1JoO?auth_id=1LxJDWg9n2&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=1LxJDWg9n2
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/broadcasts/ezjJ7d185y,xDjJBR1JoO?auth_id=1LxJDWg9n2&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: 5a3c5511-e5d4-4f8a-a266-2a4f7274d56b
X-Runtime: 0.032660
Content-Length: 337

Body

{
  "status": 200,
  "data": {
    "broadcasts": [
      {
        "id": "ezjJ7d185y",
        "message": "5",
        "status": "initialized",
        "contacts_count": 1,
        "user": {
          "email": "person_6@example.com",
          "id": "EZA9PMPJrw",
          "name": "Person 6"
        }
      },
      {
        "id": "xDjJBR1JoO",
        "message": "6",
        "status": "queued",
        "contacts_count": 0,
        "user": {
          "email": "person_6@example.com",
          "id": "EZA9PMPJrw",
          "name": "Person 6"
        }
      }
    ]
  }
}

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/2jRbkGVb1P/publish

Headers

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

Body

{
  "auth_id": "PDz9nDA8e3",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "schedule_for": 1530535989.955772,
  "asap": true
}

cURL

curl "https://www.avochato.com/v1/broadcasts/2jRbkGVb1P/publish" -d '{"auth_id":"PDz9nDA8e3","auth_secret":"YYYYYYYYYYYYYYYYYYYY","schedule_for":1530535989.955772,"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: 04814050-d4ef-41a8-b423-e7b14d84da68
X-Runtime: 0.041899
Content-Length: 182

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "2jRbkGVb1P",
      "message": "7",
      "status": "queued",
      "contacts_count": 1,
      "user": {
        "email": "person_7@example.com",
        "id": "mQL9WVzbWq",
        "name": "Person 7"
      }
    }
  }
}

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

Request

Route

POST /v1/broadcasts/xlYJpvmbmw

Headers

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

Body

{
  "auth_id": "RkAJvN1J0o",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty2.jpg",
  "via_tags": "tag2,tag3",
  "via_contact_ids": "LxJDvAgbn2",
  "via_phone_numbers": "+15105551234,+14155551234"
}

cURL

curl "https://www.avochato.com/v1/broadcasts/xlYJpvmbmw" -d '{"auth_id":"RkAJvN1J0o","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty2.jpg","via_tags":"tag2,tag3","via_contact_ids":"LxJDvAgbn2","via_phone_numbers":"+15105551234,+14155551234"}' -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: 29d9ab25-86f4-46c7-a7d9-df2950b3ce07
X-Runtime: 0.066123
Content-Length: 249

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "xlYJpvmbmw",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty2.jpg",
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_4@example.com",
        "id": "Pe6beze9Xw",
        "name": "Person 4"
      }
    }
  }
}

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": "z1N8xQAb37",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY"
}

cURL

curl "https://www.avochato.com/v1/calls" -d '{"auth_id":"z1N8xQAb37","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: 89687dc8-a014-43d8-9426-a2565f140a58
X-Runtime: 0.045738
Content-Length: 324

Body

{
  "status": 200,
  "data": {
    "call_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDpvdXRnb2luZz9hcHBTaWQ9bm90cmVhbCBzY29wZTpjbGllbnQ6aW5jb21pbmc_Y2xpZW50TmFtZT1XQW5KUVBLOXkxIiwiaXNzIjoidHdpbGlvX2FjY291bnRfc2lkIiwibmJmIjoxNTMwNTcxOTkwLCJleHAiOjE1MzA2NTgzOTB9.l1tsH4WlWUW5lfaCW3NUEQn3gUFcJgISg3-y2VLVY1c"
  }
}

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/eAbZvlAbDM,oWbqpg08qn?auth_id=1K2b24XJWR&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=1K2b24XJWR
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/contacts/eAbZvlAbDM,oWbqpg08qn?auth_id=1K2b24XJWR&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: f7be4c1c-e373-46e6-b850-833940d794c4
X-Runtime: 0.027844
Content-Length: 433

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "eAbZvlAbDM",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1530571990.81856
      },
      {
        "id": "oWbqpg08qn",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1530571990.8217459
      }
    ]
  },
  "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=EDR8zrV8A2&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1530571930.752821&created_at%5Bto%5D=1530572050.7528682&page=1

Headers

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

Query Parameters

auth_id=EDR8zrV8A2
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=name:Bob OR 'San Fran'
created_at%5Bfrom%5D=1530571930.752821
created_at%5Bto%5D=1530572050.7528682
page=1

cURL

curl "https://www.avochato.com/v1/contacts?auth_id=EDR8zrV8A2&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1530571930.752821&created_at%5Bto%5D=1530572050.7528682&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: 10b6acca-cab7-4729-b376-24a463976f7f
X-Runtime: 0.042669
Content-Length: 434

Body

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

Update Contact

Using your auth id + secret you can create or update a contact based on 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 on this contact
tags CSV of tags to apply

Request

Route

POST /v1/contacts

Headers

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

Body

{
  "auth_id": "BDr8GXabPl",
  "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":"BDr8GXabPl","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: 93b564d3-8ef7-4f87-a713-e4edc5ca2d05
X-Runtime: 0.083782
Content-Length: 262

Body

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

Events

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/xB9NQQWbYO/events?auth_id=3o48OMw9eA&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=3o48OMw9eA
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/xB9NQQWbYO/events?auth_id=3o48OMw9eA&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: 16d25d3c-bb68-4d66-8eae-1de1b037e974
X-Runtime: 0.084931
Content-Length: 1588

Body

{
  "status": 200,
  "data": {
    "events": [
      {
        "user_id": "AEgb5PL8ej",
        "status": "Closed",
        "id": "qxk9EWE8RK",
        "element_type": "StatusChange",
        "sent_at": 1530571990.169217
      },
      {
        "account_id": "enL8aDjJ7N",
        "call_from": "+15551234567",
        "call_to": "+15558888888",
        "voicemail": null,
        "direction": "in",
        "call_status": "completed",
        "ended_at": null,
        "duration": 119,
        "segments": 2,
        "id": "k5V9VLE8lr",
        "element_type": "Call",
        "sent_at": 1530571990.164237
      },
      {
        "uuid": "3b70c89d-6151-4d9f-b920-d58ee9371184",
        "account_id": "enL8aDjJ7N",
        "contact_id": "Dr8GnAaJPl",
        "ticket_id": "xB9NQQWbYO",
        "sender": "Bob McTest",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Sorry in a meeting but can call afterwards",
        "id": "M3NbrZ7br6",
        "element_type": "SmsMessage",
        "sent_at": 1530571990.1528971
      },
      {
        "uuid": "2bbfca0d-4e7b-4d4d-a25b-8e35e2e6a655",
        "account_id": "enL8aDjJ7N",
        "contact_id": "Dr8GnAaJPl",
        "ticket_id": "xB9NQQWbYO",
        "sender": "user@avochato.com",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Hey there Bob let me know when we can talk!",
        "id": "0N6bwlx9DM",
        "element_type": "SmsMessage",
        "sent_at": 1530571990.1391768
      },
      {
        "account_id": "enL8aDjJ7N",
        "call_from": "+15558888888",
        "call_to": "+15551234567",
        "voicemail": null,
        "direction": "out",
        "call_status": "completed",
        "ended_at": null,
        "duration": 10,
        "segments": 1,
        "id": "qQR91rvJge",
        "element_type": "Call",
        "sent_at": 1530571990.125777
      },
      {
        "user_id": "AEgb5PL8ej",
        "status": "Open",
        "id": "KRg80w7Jj0",
        "element_type": "StatusChange",
        "sent_at": 1530571990.102317
      },
      {
        "user_id": "AEgb5PL8ej",
        "owner_id": "AEgb5PL8ej",
        "id": "0nMJLXRJvZ",
        "element_type": "OwnerChange",
        "sent_at": 1530571990.081224
      }
    ]
  }
}

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=k5V9VkyJlr&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1530571928.622288&created_at%5Bto%5D=1530572048.622418

Headers

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

Query Parameters

auth_id=k5V9VkyJlr
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=in
status=delivered
created_at%5Bfrom%5D=1530571928.622288
created_at%5Bto%5D=1530572048.622418

cURL

curl "https://www.avochato.com/v1/messages?auth_id=k5V9VkyJlr&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1530571928.622288&created_at%5Bto%5D=1530572048.622418" -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: 57e70b2c-f060-4bdc-8cae-0eaea6806ad4
X-Runtime: 0.324224
Content-Length: 394

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "616512a6-5bdf-4dfa-9e68-aa4233966b1e",
        "account_id": "wEG8jPN9Ql",
        "contact_id": "vnJA1ABJAD",
        "ticket_id": "ePJl77N9ar",
        "sender": "+15551234567",
        "direction": "in",
        "status": "delivered",
        "error_code": 0,
        "segments": 1,
        "message": "I kept hearing that you had great service 😀!",
        "id": "enL8agj97N",
        "element_type": "SmsMessage",
        "sent_at": 1530571988.619166
      }
    ]
  },
  "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
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": "qxk9EvwJRK",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "message": "test message",
  "tags": "Some Tag, Another Tag",
  "status_callback": "http://my.domain.com"
}

cURL

curl "https://www.avochato.com/v1/messages" -d '{"auth_id":"qxk9EvwJRK","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","message":"test message","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: 411705f9-ca69-4dc4-94b0-011cb588f4f3
X-Runtime: 0.162563
Content-Length: 430

Body

{
  "status": 200,
  "data": {
    "message": {
      "uuid": "53d7f500-8296-4579-8eaa-508ec803e480",
      "account_id": "xlYJpqL8mw",
      "contact_id": "YnbgnOg8ae",
      "ticket_id": "nL8aAAp87N",
      "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",
      "id": "WAnJQkKby1",
      "element_type": "SmsMessage",
      "sent_at": 1530571989.157255
    }
  }
}

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/Rg80KKPJj0,nMJLyyE8vZ?auth_id=v7Mb64OJER&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=v7Mb64OJER
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/Rg80KKPJj0,nMJLyyE8vZ?auth_id=v7Mb64OJER&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: 8ed7bf25-bf0c-41de-b48b-934a950ddc34
X-Runtime: 0.021711
Content-Length: 360

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "a6d3f7ae-ccd5-4f69-9892-8e04d383baff",
        "contact": "OLb4WQO84Y",
        "user_id": "PweboMWJXm",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1530571990.44516
      },
      {
        "uuid": "41b1dcbe-695f-4bec-be0d-7d539a3f46d3",
        "contact": "e6beawxbXw",
        "user_id": null,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1530571990.431527
      }
    ]
  },
  "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=YOobKBN87E&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen+OR+%27Bob%27&page=1

Headers

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

Query Parameters

auth_id=YOobKBN87E
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=status:Open OR 'Bob'
page=1

cURL

curl "https://www.avochato.com/v1/tickets?auth_id=YOobKBN87E&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen+OR+%27Bob%27&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: 9dae6eff-91a1-4a8c-9915-1464771264b9
X-Runtime: 0.064845
Content-Length: 362

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "6b245ebd-6a71-46c9-96d9-277e6843d8aa",
        "contact": "K2b2xNXJWR",
        "user_id": "zPG9ydWbaO",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1530571990.3256059
      },
      {
        "uuid": "c63a8a94-03b3-42f3-af4e-be0f54591c9b",
        "contact": "DR8zMOVJA2",
        "user_id": null,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1530571990.311178
      }
    ]
  },
  "page": 1
}