Avochato API


Welcome!

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

To use the Avochato API, you will need a pair of Auth ID and Secret tokens. Tokens are account-specific and are bound to your specific User, so a pair of tokens must be generated per account. To generate a new set of tokens, please log into www.avochato.com and go to Settings > Api Access.

To get started, here are some common places you may want to check out:

  • Contacts, which represent a unique external phone number that is interacting with your Avochato number
  • Tickets, which represent a conversation between an Account and a Contact
  • Messages, which represent the messages sent and received by your Avochato number
  • Broadcasts, which let you create and schedule messages to an audience of Contacts

Accounts

Fetch Accounts

Fetch one or more Accounts by their unique subdomain

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%2Caccount_9?auth_id=qQR91xVbge&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=qQR91xVbge
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/accounts/test-account%2Caccount_9?auth_id=qQR91xVbge&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: 01d47a8d-743d-4b71-a075-ddd91b319ff5
X-Runtime: 0.011270
Content-Length: 266

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "kAJvD3ab0o",
        "subdomain": "account_9",
        "name": "Account 9",
        "phone": null,
        "created_at": 1638319679.468697
      },
      {
        "id": "YnbgnVR8ae",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": 1638319679.4797928
      }
    ]
  },
  "page": 1
}

List Accounts

List each of the Accounts this API Key can access

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=KRg80gBJj0&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=KRg80gBJj0
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/accounts?auth_id=KRg80gBJj0&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: 741a8528-60e1-4431-b5f0-5efa63c2f0f2
X-Runtime: 0.029406
Content-Length: 265

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "EnJdnWkbRm",
        "subdomain": "account_8",
        "name": "Account 8",
        "phone": null,
        "created_at": 1638319679.414773
      },
      {
        "id": "webYq1vbaE",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": 1638319679.428551
      }
    ]
  },
  "page": 1
}

Broadcasts

A Broadcast is a message that is delivered to one or more contacts. In order to send a broadcast via the API, you must
1) Create a broadcast
2) Add contacts to the broadcast audience
3)Publish your broadcast (either ASAP or in the future).

The recipients will each receive your broadcast’s message on their device in a 1-on-1 conversation with your Avochato number.
You can use variables like $first_name to customize the content of the message.
Broadcasts with large audiences or long message content will take longer to deliver to the entire audience. Broadcasts cannot be sent to groups.

Create Broadcast

Create a new broadcast

Endpoint

POST /v1/broadcasts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
message required String, the Message you want to broadcast (1600 character limit)
media_url Url of media to send in MMS (500kb limit)
status_callback Url to send status updates for each message sent by this broadcast
name String, name of this broadcast
via_tags Comma-separated list of contact tags to add to this broadcast
via_contact_ids Comma-separated list of contact ids to add to this broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to this broadcast
via_field[field] String, either name ,phone ,phone_formatted ,email ,company ,street ,city ,state ,country ,zip ,priority ,opted_out ,salesforce_object_id ,salesforce_object_type, 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": "3YnbgE5Jae",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty.jpg",
  "status_callback": "https://somesite.com/some_callback_route",
  "name": "My New Broadcast",
  "via_tags": "tag1,tag2",
  "via_contact_ids": "2jRbkqVJ1P",
  "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":"3YnbgE5Jae","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty.jpg","status_callback":"https://somesite.com/some_callback_route","name":"My New Broadcast","via_tags":"tag1,tag2","via_contact_ids":"2jRbkqVJ1P","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: 7edc472e-cc97-40b8-bc1d-7c47e0714c6b
X-Runtime: 0.103779
Content-Length: 365

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "0N6bwQPJDM",
      "name": "My New Broadcast",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty.jpg",
      "status": "initialized",
      "contacts_count": 0,
      "user": {
        "email": "person_9@example.com",
        "id": "43y83npJVN",
        "name": "Person 9"
      },
      "status_callback": "https://somesite.com/some_callback_route",
      "pending_contacts_count": null
    }
  }
}

Fetch Broadcasts

Fetch one or more 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 Broadcast ids to fetch
page Page number to request

Request

Route

GET /v1/broadcasts/PxB9NX28YO%2CBLP9MMj9qY?auth_id=AwebY0A8aE&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=AwebY0A8aE
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/broadcasts/PxB9NX28YO%2CBLP9MMj9qY?auth_id=AwebY0A8aE&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: be49a066-0973-4049-aceb-68e4ac8ade92
X-Runtime: 0.013710
Content-Length: 441

Body

{
  "status": 200,
  "data": {
    "broadcasts": [
      {
        "id": "PxB9NX28YO",
        "name": null,
        "message": "3",
        "media_url": null,
        "status": "initialized",
        "contacts_count": 1,
        "user": {
          "email": "person_7@example.com",
          "id": "GeAbZEA8DM",
          "name": "Person 7"
        },
        "status_callback": null
      },
      {
        "id": "BLP9MMj9qY",
        "name": null,
        "message": "4",
        "media_url": null,
        "status": "queued",
        "contacts_count": 0,
        "user": {
          "email": "person_7@example.com",
          "id": "GeAbZEA8DM",
          "name": "Person 7"
        },
        "status_callback": null
      }
    ]
  }
}

Publish Broadcast

Publish your broadcast

Endpoint

POST /v1/broadcasts/:id/publish

Parameters

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

Request

Route

POST /v1/broadcasts/2jRbkdV91P/publish

Headers

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

Body

{
  "auth_id": "NEnJd0LJRm",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "scheduled_for": 1638283680.399859,
  "asap": true
}

cURL

curl "https://www.avochato.com/v1/broadcasts/2jRbkdV91P/publish" -d '{"auth_id":"NEnJd0LJRm","auth_secret":"YYYYYYYYYYYYYYYYYYYY","scheduled_for":1638283680.399859,"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: 2a63978d-d285-4bf3-b8ec-758abbbcd53d
X-Runtime: 0.059708
Content-Length: 239

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "2jRbkdV91P",
      "name": null,
      "message": "1",
      "media_url": null,
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_6@example.com",
        "id": "Pwebol59Xm",
        "name": "Person 6"
      },
      "status_callback": null
    }
  }
}

Update Broadcast

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 String, the Message you want to broadcast (1600 character limit)
media_url Url of media to send in MMS (500kb limit)
name String, name of this broadcast
via_tags Comma-separated list of contact tags to add to this broadcast
via_contact_ids Comma-separated list of contact ids to add to this broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to this broadcast
via_field[field] String, [:name, :phone, :phone_formatted, :email, :company, :street, :city, :state, :country, :zip, :priority, :opted_out, :salesforce_object_id, :salesforce_object_type], 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/WAnJQzv8y1

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/broadcasts/WAnJQzv8y1" -d '{"auth_id":"RkAJvMR90o","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty2.jpg","name":"My Other Broadcast","via_tags":"tag2,tag3","via_contact_ids":"VePJlqK8ar","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: be5e763b-febb-4540-b54f-dafa040e4df0
X-Runtime: 0.108548
Content-Length: 327

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "WAnJQzv8y1",
      "name": "My Other Broadcast",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty2.jpg",
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_8@example.com",
        "id": "xoWbqB09qn",
        "name": "Person 8"
      },
      "status_callback": null,
      "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": "v5D9RqWbVA",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY"
}

cURL

curl "https://www.avochato.com/v1/calls" -d '{"auth_id":"v5D9RqWbVA","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: 08acec09-c746-4582-95a9-6d096caefed7
X-Runtime: 0.024201
Content-Length: 324

Body

{
  "status": 200,
  "data": {
    "call_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDpvdXRnb2luZz9hcHBTaWQ9bm90cmVhbCBzY29wZTpjbGllbnQ6aW5jb21pbmc_Y2xpZW50TmFtZT1MUDlNeld3SnFZIiwiaXNzIjoidHdpbGlvX2FjY291bnRfc2lkIiwibmJmIjoxNjM4MzE5Njg1LCJleHAiOjE2Mzg0MDYwODV9.yDkYPtgnDnnKhxnlav5Vc6PFV1pPbs4PBomqQfiObQI"
  }
}

Campaigns

Fetch Campaigns

Using your auth id + secret you can fetch campaign macros by ids

Endpoint

GET /v1/campaigns/:ids

Parameters

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

Request

Route

GET /v1/campaigns/one?auth_id=kvnJAv58AD&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=kvnJAv58AD
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/campaigns/one?auth_id=kvnJAv58AD&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: 57a7888c-62b6-4d44-a5a9-e8663031875f
X-Runtime: 0.016042
Content-Length: 245

Body

{
  "status": 200,
  "data": {
    "campaigns": [
      {
        "id": "PDz9nV29e3",
        "key": "one",
        "raw_text": "[Campaign 1] first message",
        "follow_up_message": "[Campaign 1] second message",
        "follow_up_delay": null,
        "media_url": null,
        "hash_id": "PDz9nV29e3",
        "hotkey": null
      }
    ]
  },
  "page": 1
}

List Campaigns

Using your auth id + secret you can get all defined campaigns

Endpoint

GET /v1/campaigns

Parameters

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

Request

Route

GET /v1/campaigns?auth_id=qxk9Ez7JRK&auth_secret=YYYYYYYYYYYYYYYYYYYY

Headers

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

Query Parameters

auth_id=qxk9Ez7JRK
auth_secret=YYYYYYYYYYYYYYYYYYYY

cURL

curl -g "https://www.avochato.com/v1/campaigns?auth_id=qxk9Ez7JRK&auth_secret=YYYYYYYYYYYYYYYYYYYY" -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: cbf95487-bc4b-40a3-87ef-06dd95b76504
X-Runtime: 0.011205
Content-Length: 435

Body

{
  "status": 200,
  "data": {
    "campaigns": [
      {
        "id": "1LxJDvKbn2",
        "key": "two",
        "raw_text": "[Campaign 2] first message",
        "follow_up_message": "[Campaign 2] second message",
        "follow_up_delay": null,
        "media_url": null,
        "hash_id": "1LxJDvKbn2",
        "hotkey": null
      },
      {
        "id": "3Ynbgne8ae",
        "key": "one",
        "raw_text": "[Campaign 1] first message",
        "follow_up_message": "[Campaign 1] second message",
        "follow_up_delay": null,
        "media_url": null,
        "hash_id": "3Ynbgne8ae",
        "hotkey": null
      }
    ]
  }
}

Remove all contacts from campaign

Using your auth id + secret you can remove all contacts from a campaign

Endpoint

POST /v1/campaigns/:id/cancel

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Campaign keyword
phone Phone number of the contact to cancel
contacts List of contacts to cancel

Request

Route

POST /v1/campaigns/one/cancel

Headers

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

Body

{
  "auth_id": "0N6bwQPJDM",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY"
}

cURL

curl "https://www.avochato.com/v1/campaigns/one/cancel" -d '{"auth_id":"0N6bwQPJDM","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: 2c64f6bb-9dc9-4db0-b963-dbe71021d1ef
X-Runtime: 0.086829
Content-Length: 59

Body

{
  "status": 200,
  "data": {
    "campaigns": "Processing 2 entries."
  }
}

Remove multiple contacts from campaign

Using your auth id + secret you can remove contacts from a campaign by their phone numbers

Endpoint

POST /v1/campaigns/:id/cancel

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Campaign keyword
phone Phone number of the contact to cancel
contacts List of contacts to cancel

Request

Route

POST /v1/campaigns/one/cancel

Headers

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

Body

{
  "auth_id": "M3Nbrzobr6",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "contacts": [
    "+15551234568",
    "+15105551234"
  ]
}

cURL

curl "https://www.avochato.com/v1/campaigns/one/cancel" -d '{"auth_id":"M3Nbrzobr6","auth_secret":"YYYYYYYYYYYYYYYYYYYY","contacts":["+15551234568","+15105551234"]}' -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: 083779f9-ceb1-4e5d-bc22-2ca90b1cfabf
X-Runtime: 0.037317
Content-Length: 59

Body

{
  "status": 200,
  "data": {
    "campaigns": "Processing 2 entries."
  }
}

Remove single contact from campaign

Using your auth id + secret you can remove contacts from a campaign by their phone numbers

Endpoint

POST /v1/campaigns/:id/cancel

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Campaign keyword
phone Phone number of the contact to cancel
contacts List of contacts to cancel

Request

Route

POST /v1/campaigns/one/cancel

Headers

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

Body

{
  "auth_id": "k5V9VAGblr",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15105551234"
}

cURL

curl "https://www.avochato.com/v1/campaigns/one/cancel" -d '{"auth_id":"k5V9VAGblr","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15105551234"}' -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: ebcad6f7-6b73-4d2a-8137-eeb75275a850
X-Runtime: 0.025642
Content-Length: 24

Body

{
  "status": 200,
  "data": {
  }
}

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/z1N8xq6b37%2Cv7Mb6EG8ER?auth_id=EDR8zpk9A2&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=EDR8zpk9A2
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/contacts/z1N8xq6b37%2Cv7Mb6EG8ER?auth_id=EDR8zpk9A2&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: a3315f73-320e-4ba1-90ec-05017df19233
X-Runtime: 0.014483
Content-Length: 897

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "v7Mb6EG8ER",
        "name": "Bob McTest",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "street": null,
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "notes": null,
        "company": "McTest Inc",
        "other_phone": null,
        "created_at": 1638319082.91821,
        "tags": [
          "important"
        ],
        "opted_out": false,
        "double_opted_in": false,
        "muted": false,
        "blocked": null,
        "salesforce_object_type": null,
        "salesforce_object_id": null,
        "priority": 0,
        "user_id": null,
        "visible": true
      },
      {
        "id": "z1N8xq6b37",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "street": null,
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "notes": null,
        "company": "Contact Inc",
        "other_phone": null,
        "created_at": 1638319682.94931,
        "tags": [

        ],
        "opted_out": false,
        "double_opted_in": false,
        "muted": false,
        "blocked": null,
        "salesforce_object_type": null,
        "salesforce_object_id": null,
        "priority": 0,
        "user_id": null,
        "visible": true
      }
    ]
  },
  "page": 1
}

Remove all contacts

Remove all contacts from this inbox.

Endpoint

DELETE /v1/contacts/remove_all

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String. If query is empty or no query parameter is provided, remove *all* contacts from the contacts list in this inbox. If a query is provided, only contacts matching the query will be removed from this inbox.

Request

Route

DELETE /v1/contacts/remove_all

Headers

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

Body

{
  "auth_id": "1K2b2qY8WR",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "query": null
}

cURL

curl "https://www.avochato.com/v1/contacts/remove_all" -d '{"auth_id":"1K2b2qY8WR","auth_secret":"YYYYYYYYYYYYYYYYYYYY","query":null}' -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: 360bfe35-62e7-44a4-a602-d3e32b7f6087
X-Runtime: 0.013566
Content-Length: 58

Body

{
  "status": 200,
  "data": {
    "account": "account_27",
    "query": "*"
  }
}

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=BDr8GzNJPl&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+city%3A%22San+Francisco%22&created_at%5Bfrom%5D=1638319022.881213&created_at%5Bto%5D=1638319142.881235&page=1

Headers

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

Query Parameters

auth_id=BDr8GzNJPl
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=name:Bob OR city:"San Francisco"
created_at={"from"=>"1638319022.881213", "to"=>"1638319142.881235"}
page=1

cURL

curl -g "https://www.avochato.com/v1/contacts?auth_id=BDr8GzNJPl&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+city%3A%22San+Francisco%22&created_at%5Bfrom%5D=1638319022.881213&created_at%5Bto%5D=1638319142.881235&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: 95550cad-d2fd-4c1d-86ce-5c58ccd57c5c
X-Runtime: 0.023213
Content-Length: 462

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "3o48OwZ8eA",
        "name": "Bob McTest",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "street": null,
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "notes": null,
        "company": "McTest Inc",
        "other_phone": null,
        "created_at": 1638319082.80618,
        "tags": [

        ],
        "opted_out": false,
        "double_opted_in": false,
        "muted": false,
        "blocked": null,
        "salesforce_object_type": null,
        "salesforce_object_id": null,
        "priority": 0,
        "user_id": null,
        "visible": true
      }
    ]
  },
  "page": 1
}

Update Multiple Contacts

Create or update multiple Contacts based on their phone numbers. Given a list of contacts, Avochato will attempt to update or create a record for each unique 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
contacts required List of Contacts
contacts[n][phone] required Phone number of Contact
contacts[n][name] Name of the Contact
contacts[n][email] Email for the Contact
contacts[n][other_phone] Other phone for the Contact
contacts[n][company] Company Name for the Contact
contacts[n][street] Street for the Contact
contacts[n][city] City for the Contact
contacts[n][state] State for the Contact
contacts[n][zip] Zip Code for the Contact
contacts[n][country] Country for the Contact
contacts[n][opted_out] Opted-out status of the Contact. Avochato will prevent any outbound message to an opted out contact.
contacts[n][double_opted_in] Boolean, 0 or 1. Update the Double Opt-in status of the contact.
contacts[n][muted] Boolean, 0 or 1. Mute or unmute the Contact to suppress calls and notifications from them.
contacts[n][blocked] Boolean, 0 or 1. Block or unblock the Contact to prevent all calls and texts to and from them.
contacts[n][priority] Integer, 0 through 5. Sets a priority level for the contact, 5 is the greatest.
contacts[n][visible] Boolean, 0 or 1. Visibility status of the Contact. Set to 0 to remove the contact.
contacts[n][custom_variable_name] Custom field to set for the Contact
contacts[n][tags] CSV of tags to apply to the Contact
contacts[n][user_id] User ID or Email of a User that is responsible for this contact. Assigns all conversations to the user when set.
contacts[n][salesforce_object_id] Salesforce object id
contacts[n][salesforce_object_type] Salesforce object type
allow_empty_fields Boolean, 0 or 1. Permit overwriting custom fields with empty or null value (defaults to 0)

Request

Route

POST /v1/contacts

Headers

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

Body

{
  "auth_id": "v7Mb6kG9ER",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "contacts": [
    {
      "phone": "+14155553333",
      "name": "Bob McTest",
      "email": "contact@example.com",
      "company": "Example Inc.",
      "street": "123 Main St.",
      "city": "SF",
      "state": "CA",
      "zip": "99999",
      "country": "USA",
      "opted_out": false,
      "visible": true,
      "custom_variable_name": "value to set custom variable",
      "tags": "red,green,blue",
      "user_id": "teammate@example.com",
      "salesforce_object_id": "0030030000000014cAAA",
      "salesforce_object_type": "Contact"
    }
  ]
}

cURL

curl "https://www.avochato.com/v1/contacts" -d '{"auth_id":"v7Mb6kG9ER","auth_secret":"YYYYYYYYYYYYYYYYYYYY","contacts":[{"phone":"+14155553333","name":"Bob McTest","email":"contact@example.com","company":"Example Inc.","street":"123 Main St.","city":"SF","state":"CA","zip":"99999","country":"USA","opted_out":false,"visible":true,"custom_variable_name":"value to set custom variable","tags":"red,green,blue","user_id":"teammate@example.com","salesforce_object_id":"0030030000000014cAAA","salesforce_object_type":"Contact"}]}' -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: 8d6e4015-d817-4cc6-a331-c7e95d9a2b55
X-Runtime: 0.171437
Content-Length: 563

Body

{
  "status": 200,
  "data": {
    "contact": {
      "id": "RkAJvqR90o",
      "name": "Bob McTest",
      "phone": "+14155553333",
      "email": "contact@example.com",
      "street": "123 Main St.",
      "city": "SF",
      "state": "CA",
      "zip": "99999",
      "notes": null,
      "company": "Example Inc.",
      "other_phone": null,
      "created_at": 1638319682.47853,
      "tags": [
        "red",
        "green",
        "blue"
      ],
      "opted_out": false,
      "double_opted_in": false,
      "muted": false,
      "blocked": null,
      "salesforce_object_type": "Contact",
      "salesforce_object_id": "0030030000000014cAAA",
      "priority": 0,
      "user_id": "VePJlM68ar",
      "visible": true,
      "custom_variable_name": "value to set custom variable"
    }
  }
}

Update Single Contact

Create or update a single 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 Name for the Contact
street Street for the Contact
city City for the Contact
state State for the Contact
zip Zip Code for the Contact
country Country for the Contact
opted_out Opted-out status of the Contact. Avochato will prevent any outbound message to an opted out contact.
double_opted_in Boolean, 0 or 1. Update the Double Opt-in status of the contact.
muted Boolean, 0 or 1. Mute or unmute the Contact to suppress calls and notifications from them.
blocked Boolean, 0 or 1. Block or unblock the Contact to prevent all calls and texts to and from them.
priority Integer, 0 through 5. Sets a priority level for the contact, 5 is the greatest.
visible Boolean, 0 or 1. Visibility status of the Contact. Set to 0 to remove the contact.
custom_variable_name Custom variable to set for the Contact
tags CSV of tags to apply to the Contact
user_id User ID or Email of a User that is responsible for this contact. Assigns all conversations to the user when set.
salesforce_object_id Salesforce object id
salesforce_object_type Salesforce object type
allow_empty_fields Boolean, 0 or 1. Permit overwriting custom fields with empty or null value (defaults to 0)

Request

Route

POST /v1/contacts

Headers

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

Body

{
  "auth_id": "z1N8xM6b37",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "name": "Bob McTest",
  "email": "contact@example.com",
  "company": "Example Inc.",
  "street": "123 Main St.",
  "city": "SF",
  "state": "CA",
  "zip": "99999",
  "country": "USA",
  "opted_out": false,
  "visible": true,
  "custom_variable_name": "value to set custom variable",
  "tags": "red,green,blue",
  "user_id": "teammate@example.com",
  "salesforce_object_id": "0030030000000014cAAA",
  "salesforce_object_type": "Contact"
}

cURL

curl "https://www.avochato.com/v1/contacts" -d '{"auth_id":"z1N8xM6b37","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","name":"Bob McTest","email":"contact@example.com","company":"Example Inc.","street":"123 Main St.","city":"SF","state":"CA","zip":"99999","country":"USA","opted_out":false,"visible":true,"custom_variable_name":"value to set custom variable","tags":"red,green,blue","user_id":"teammate@example.com","salesforce_object_id":"0030030000000014cAAA","salesforce_object_type":"Contact"}' -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: e7a9b48e-6059-48c7-850f-7a360b54d491
X-Runtime: 0.071980
Content-Length: 534

Body

{
  "status": 200,
  "data": {
    "contact": {
      "id": "PDz9nqmbe3",
      "name": "Bob McTest",
      "phone": "+14155553333",
      "email": "contact@example.com",
      "street": "123 Main St.",
      "city": "SF",
      "state": "CA",
      "zip": "99999",
      "notes": null,
      "company": "Example Inc.",
      "other_phone": null,
      "created_at": 1638319682.7345,
      "tags": [

      ],
      "opted_out": false,
      "double_opted_in": false,
      "muted": false,
      "blocked": null,
      "salesforce_object_type": "Contact",
      "salesforce_object_id": "0030030000000014cAAA",
      "priority": 0,
      "user_id": null,
      "visible": true,
      "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/Pwebo4G9Xm/events

Headers

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

Body

{
  "auth_id": "Pwebo6G8Xm",
  "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/Pwebo4G9Xm/events" -d '{"auth_id":"Pwebo6G8Xm","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: 78f3412d-c64b-4962-a6f5-1ccfe5320bfa
X-Runtime: 0.017641
Content-Length: 326

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "ezjJ7x385y",
      "account_id": "ePJl7nO9ar",
      "ticket_id": "AEgb5p48ej",
      "contact_id": "Pwebo4G9Xm",
      "type": "sale",
      "context": "Wanted a new watch ($99.99) with no warranty",
      "revenue": 99.99,
      "event_id": "enL8ajab7N",
      "element_id": "k5V9Vz9lrR",
      "element_type": "CustomEvent",
      "sent_at": 1638319684.51521
    }
  }
}

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": "zPG9yLQbaO",
  "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":"zPG9yLQbaO","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: 77d8bbfe-3b3b-4a92-a845-69315a178de3
X-Runtime: 0.017377
Content-Length: 339

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "VePJlMA8ar",
      "account_id": "d6JmzGl87m",
      "ticket_id": "mQL9Wey8Wq",
      "contact_id": "zPG9y4QbaO",
      "type": "sale",
      "context": "Bought an avocado ($2) and was interested in a subscription",
      "revenue": 2.0,
      "event_id": "0nMJLNkbvZ",
      "element_id": "M3NbrK9r6q",
      "element_type": "CustomEvent",
      "sent_at": 1638319684.31758
    }
  }
}

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/EZA9P0l9rw/events

Headers

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

Body

{
  "auth_id": "AEgb5448ej",
  "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/EZA9P0l9rw/events" -d '{"auth_id":"AEgb5448ej","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: 492d3ea6-a625-4418-a26e-f5e6f52f7519
X-Runtime: 0.027223
Content-Length: 329

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "wd6JmQdJ7m",
      "account_id": "MvbX0LnbRm",
      "ticket_id": "EZA9P0l9rw",
      "contact_id": "AEgb554bej",
      "type": "sale",
      "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
      "revenue": 15.5,
      "event_id": "VePJlYY8ar",
      "element_id": "0N6bwR8DML",
      "element_type": "CustomEvent",
      "sent_at": 1638319684.10763
    }
  }
}

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

Headers

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

Query Parameters

auth_id=mQL9WRybWq
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/tickets/3OLb42qJ4Y/events?auth_id=mQL9WRybWq&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: ee0d64b0-79a1-4c56-a8db-7c18d0de83c1
X-Runtime: 0.036809
Content-Length: 2306

Body

{
  "status": 200,
  "data": {
    "events": [
      {
        "account_id": "5D9R0oL8VA",
        "ticket_id": "3OLb42qJ4Y",
        "user_id": "ZMvbXZlJRm",
        "status": "Closed",
        "event_id": "GeAbZv3bDM",
        "element_id": "2jRbk681Pv",
        "element_type": "StatusChange",
        "sent_at": 1638319683.86024
      },
      {
        "account_id": "5D9R0oL8VA",
        "call_from": "+15551234567",
        "call_to": "+15558888888",
        "voicemail": null,
        "direction": "in",
        "call_status": "completed",
        "ended_at": 0.0,
        "duration": 119,
        "segments": 2,
        "event_id": "Pweboa1JXm",
        "element_id": "qQR9178geK",
        "element_type": "Call",
        "sent_at": 1638319683.85609
      },
      {
        "uuid": "e5b12975-0b64-45b5-9444-55f135d2ced7",
        "account_id": "5D9R0oL8VA",
        "ticket_id": "3OLb42qJ4Y",
        "contact_id": "mQL9WYy8Wq",
        "sender_id": "ZMvbXZlJRm",
        "sender_type": "User",
        "to": null,
        "from": null,
        "direction": "out",
        "origin": null,
        "message": "Sorry in a meeting but can call afterwards",
        "contents": [

        ],
        "segments": 1,
        "carrier": null,
        "external_id": null,
        "status": "queued",
        "error_code": 0,
        "reason": null,
        "status_callback": null,
        "created_at": 1638319683.79513,
        "sent_at": 1638319683.81418,
        "event_id": "zPG9y3g8aO",
        "element_id": "VePJlYY8ar",
        "element_type": "SmsMessage"
      },
      {
        "uuid": "b5f96cdb-daae-40f2-a80b-af51f1c126c8",
        "account_id": "5D9R0oL8VA",
        "ticket_id": "3OLb42qJ4Y",
        "contact_id": "mQL9WYy8Wq",
        "sender_id": "ZMvbXZlJRm",
        "sender_type": "User",
        "to": null,
        "from": null,
        "direction": "out",
        "origin": null,
        "message": "Hey there Bob let me know when we can talk!",
        "contents": [

        ],
        "segments": 1,
        "carrier": null,
        "external_id": null,
        "status": "queued",
        "error_code": 0,
        "reason": null,
        "status_callback": null,
        "created_at": 1638319683.73915,
        "sent_at": 1638319683.75907,
        "event_id": "AEgb56r9ej",
        "element_id": "wd6Jmxz97m",
        "element_type": "SmsMessage"
      },
      {
        "account_id": "5D9R0oL8VA",
        "call_from": "+15558888888",
        "call_to": "+15551234567",
        "voicemail": null,
        "direction": "out",
        "call_status": "completed",
        "ended_at": 0.0,
        "duration": 10,
        "segments": 1,
        "event_id": "mQL9WL7JWq",
        "element_id": "KRg80abj0q",
        "element_type": "Call",
        "sent_at": 1638319683.73717
      },
      {
        "account_id": "5D9R0oL8VA",
        "ticket_id": "3OLb42qJ4Y",
        "user_id": "ZMvbXZlJRm",
        "status": "Open",
        "event_id": "EZA9Pl59rw",
        "element_id": "xDjJBRJoOe",
        "element_type": "StatusChange",
        "sent_at": 1638319683.72581
      },
      {
        "account_id": "5D9R0oL8VA",
        "ticket_id": "3OLb42qJ4Y",
        "user_id": "ZMvbXZlJRm",
        "owner_id": "ZMvbXZlJRm",
        "event_id": "3OLb4WY84Y",
        "element_id": "ezjJ7L85yZ",
        "element_type": "OwnerChange",
        "sent_at": 1638319683.72262
      }
    ]
  },
  "page": 1
}

Messages

Search Messages

Search for matching Messages in an account based on a query.

Endpoint

GET /v1/messages

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
query Query to search Messages (default: iterate through all messages) string
page Page to request (default: 1) integer
direction Direction of the message ("in" for received messages, "out" for sent messages) string
status Message delivery status (ie: queued, delivered, undelivered, failed) string
from Phone number message was sent from string
to Phone number message was sent to string
created_at[from] Select messages created after this date unix_timestamp
created_at[to] Select messages created before this date (default: now) unix_timestamp

Request

Route

GET /v1/messages?auth_id=PDz9nXm8e3&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1638313681.678559&created_at%5Bto%5D=1638319741.678581

Headers

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

Query Parameters

auth_id=PDz9nXm8e3
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=in
status=delivered
from=+15105551234
to=+14155551234
created_at={"from"=>"1638313681.678559", "to"=>"1638319741.678581"}

cURL

curl -g "https://www.avochato.com/v1/messages?auth_id=PDz9nXm8e3&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1638313681.678559&created_at%5Bto%5D=1638319741.678581" -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: 503a2695-cdc1-4c6e-af65-b7899dfa79dd
X-Runtime: 0.064408
Content-Length: 608

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "8701a4c1-eb39-4407-9a9f-847b6a6f7d5f",
        "account_id": "OLb4W2E84Y",
        "ticket_id": "3Ynbgd59ae",
        "contact_id": "KRg80RB9j0",
        "sender_id": null,
        "sender_type": null,
        "to": "+14155551234",
        "from": "+15105551234",
        "direction": "in",
        "origin": null,
        "message": "I kept hearing that you had great service 😀!",
        "contents": [

        ],
        "segments": 1,
        "carrier": null,
        "external_id": null,
        "status": "delivered",
        "error_code": 0,
        "reason": null,
        "status_callback": null,
        "created_at": 1638319681.62979,
        "sent_at": 1638319681.64831,
        "event_id": "1LxJDvKbn2",
        "element_id": "43y832xJVN",
        "element_type": "SmsMessage"
      }
    ]
  },
  "page": 1
}

Search Messages by timestamp

Search for matching Messages based on a query

Endpoint

GET /v1/messages

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
query Query to search Messages (default: iterate through all messages) string
page Page to request (default: 1) integer
direction Direction of the message ("in" for received messages, "out" for sent messages) string
status Message delivery status (ie: queued, delivered, undelivered, failed) string
from Phone number message was sent from string
to Phone number message was sent to string
created_at[from] Select messages created after this date unix_timestamp
created_at[to] Select messages created before this date (default: now) unix_timestamp

Request

Route

GET /v1/messages?auth_id=3o48OmZ9eA&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1638319621.9656289&created_at%5Bto%5D=1638319741.9656909&document=false

Headers

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

Query Parameters

auth_id=3o48OmZ9eA
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=
status=delivered
from=+15105551234
to=+14155551234
created_at={"from"=>"1638319621.9656289", "to"=>"1638319741.9656909"}
document=false

cURL

curl -g "https://www.avochato.com/v1/messages?auth_id=3o48OmZ9eA&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1638319621.9656289&created_at%5Bto%5D=1638319741.9656909&document=false" -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: aa9518a1-cfe9-4904-8439-98bf46498f3b
X-Runtime: 0.026330
Content-Length: 608

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "224543e6-746c-45b8-830f-befc6db78b5f",
        "account_id": "ZA9Pl0Y9rw",
        "ticket_id": "PDz9nRm9e3",
        "contact_id": "0N6bwqPJDM",
        "sender_id": null,
        "sender_type": null,
        "to": "+14155551234",
        "from": "+15105551234",
        "direction": "in",
        "origin": null,
        "message": "I kept hearing that you had great service 😀!",
        "contents": [

        ],
        "segments": 1,
        "carrier": null,
        "external_id": null,
        "status": "delivered",
        "error_code": 0,
        "reason": null,
        "status_callback": null,
        "created_at": 1638319681.91005,
        "sent_at": 1638319681.93168,
        "event_id": "3o48OvgJeA",
        "element_id": "xlYJplqJmw",
        "element_type": "SmsMessage"
      }
    ]
  },
  "page": 1
}

Send Message

Send a Message to any Contact based on their phone

Endpoint

POST /v1/messages

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number to send the message to string
message required Text to send to the recipient string
from (E.164 format) Phone Number to use to send this message. Must be a valid Avochato number that belongs to this inbox. string
mark_addressed Mark this conversation as "addressed" (default: false) boolean
media_url Media attachment to send via MMS (500kb limit) url
tags Comma-separated list of tags to apply to this contact string
status_callback Send a callback via http POST to this domain when the delivery status is updated url
send_as_user_id Send on behalf of another user (match by ID). That user must belong to this API token's account. string
send_as_user_email Send on behalf of another user (match by email). That user must belong to this API token's account. string

Request

Route

POST /v1/messages

Headers

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

Body

{
  "auth_id": "3o48O4xbeA",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "message": "test message",
  "from": "+15105551234",
  "mark_addressed": "true",
  "tags": "Some Tag, Another Tag",
  "status_callback": "https://my.domain.com",
  "send_as_user_email": "test-2@test.com"
}

cURL

curl "https://www.avochato.com/v1/messages" -d '{"auth_id":"3o48O4xbeA","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","message":"test message","from":"+15105551234","mark_addressed":"true","tags":"Some Tag, Another Tag","status_callback":"https://my.domain.com","send_as_user_email":"test-2@test.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: 493e4c3e-edaf-43ae-9c31-9ae6d3474734
X-Runtime: 0.667580
Content-Length: 620

Body

{
  "status": 200,
  "data": {
    "message": {
      "uuid": "75aaa004-e5db-4956-80da-350b54953429",
      "account_id": "OLb4pZGb4Y",
      "ticket_id": "webYqDmbaE",
      "contact_id": "QL9WL03JWq",
      "sender_id": "YnbgEd0Jae",
      "sender_type": "User",
      "to": "+14155553333",
      "from": null,
      "direction": "out",
      "origin": "api",
      "message": "test message\n[Account 35: Reply STOP to opt out]",
      "contents": [

      ],
      "segments": 1,
      "carrier": "twilio",
      "external_id": null,
      "status": "queued",
      "error_code": 0,
      "reason": null,
      "status_callback": "https://my.domain.com",
      "created_at": 1656701023.12346,
      "sent_at": 1656701023.12059,
      "event_id": "KRg80Dz8j0",
      "element_id": "3YnbgO6bae",
      "element_type": "SmsMessage"
    }
  }
}

Send a Scheduled Message

Schedule a Message to deliver to a Contact at a specific date and time in the future

Endpoint

POST /v1/messages

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number to send the message to string
message required Text to send to the recipient string
scheduled_for required Unix Timestamp, Schedule this message to send at a date in the future unix_timestamp
from (E.164 format) Phone Number to use to send this message. Must be a valid Avochato number that belongs to this inbox. string
mark_addressed Mark this conversation as "addressed" (default: false) boolean
media_url Media attachment to send via MMS (500kb limit) url
tags Comma-separated list of tags to apply to this contact string
status_callback Send a callback via http POST to this domain when the delivery status is updated url
send_as_user_id Send on behalf of another user (match by ID). That user must belong to this API token's account. string
send_as_user_email Send on behalf of another user (match by email). That user must belong to this API token's account. string

Request

Route

POST /v1/messages

Headers

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

Body

{
  "auth_id": "PDz9nxR8e3",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "message": "test message",
  "scheduled_for": 1656701621.890741,
  "from": "+15105551234",
  "mark_addressed": "true",
  "tags": "Some Tag, Another Tag",
  "status_callback": "https://my.domain.com",
  "send_as_user_email": "test-2@test.com"
}

cURL

curl "https://www.avochato.com/v1/messages" -d '{"auth_id":"PDz9nxR8e3","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","message":"test message","scheduled_for":1656701621.890741,"from":"+15105551234","mark_addressed":"true","tags":"Some Tag, Another Tag","status_callback":"https://my.domain.com","send_as_user_email":"test-2@test.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: 11c221d8-eb2c-4885-8125-abed354652a4
X-Runtime: 0.284067
Content-Length: 451

Body

{
  "status": 200,
  "data": {
    "message": {
      "account_id": "e6beW1NJXw",
      "ticket_id": "xk9ELlEbRK",
      "contact_id": "e6beaKxbXw",
      "sender": "person_38",
      "message": "test message",
      "media_url": null,
      "aborted": false,
      "sent": {
        "element_id": null,
        "element_type": null
      },
      "scheduled_for": 1656701621.0,
      "cancel_on": null,
      "aborter_id": null,
      "aborted_by": "User",
      "abort_reason": null,
      "event_id": "PxB9N30JYO",
      "element_id": "PxB9NQVbYO",
      "element_type": "PendingMessage",
      "sent_at": 1656701022.16357
    }
  }
}

Tags

Add Tag (Contact id)

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/PweboqGJXm%2CzPG9yqQ9aO/tags

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/contacts/PweboqGJXm%2CzPG9yqQ9aO/tags" -d '{"auth_id":"0nMJLNKbvZ","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: e9333f32-2e4c-4876-b2fe-d87b5c39ef4a
X-Runtime: 0.020745
Content-Length: 94

Body

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

Add Tag (Phone)

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": "BLP9MMj9qY",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-new-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"BLP9MMj9qY","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: 7b9e6c2a-bee8-443d-8b4b-a4b84d4a448b
X-Runtime: 0.033830
Content-Length: 81

Body

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

Remove Tag (Contact id)

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/Pe6beM2bXw%2C1K2b2zYbWR/tags

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/contacts/Pe6beM2bXw%2C1K2b2zYbWR/tags" -d '{"auth_id":"PxB9NX28YO","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: e4e7199d-b390-4be1-9f16-19308c06bb3a
X-Runtime: 0.075548
Content-Length: 96

Body

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

Remove Tag (Phone)

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": "WAnJQzv8y1",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-old-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"WAnJQzv8y1","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: c45e1691-6ac0-4968-aaf6-dc531ab0756f
X-Runtime: 0.014043
Content-Length: 83

Body

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

Ticket Assignment

Ticket Assignment represents which user on your team owns a conversation. The owner assigned to a conversation will receive notifications of incoming calls and texts from that contact.

Auto Assign

You can automatically reassign one or more Tickets to any user in the Auto Assignment Roster by id. If there are no active users in your Auto Assignment Roster, ownership will remain unchanged. See Settings > Auto Assignment

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
user_id required autoassign string

Request

Route

PUT /v1/tickets/BLP9MWj8qY

Headers

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

Body

{
  "auth_id": "wd6Jm6p87m",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "user_id": "autoassign"
}

cURL

curl "https://www.avochato.com/v1/tickets/BLP9MWj8qY" -d '{"auth_id":"wd6Jm6p87m","auth_secret":"YYYYYYYYYYYYYYYYYYYY","user_id":"autoassign"}' -X PUT \
	-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: f57cdb69-86d8-40c9-9e9e-adf27ddf3322
X-Runtime: 0.070536
Content-Length: 370

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "BLP9MWj8qY",
        "uuid": "4c202c9b-c6cf-4cfd-8393-ff4d7289c4f7",
        "contact": "2jRbk4V91P",
        "user_id": "qQR91g08ge",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319685.524163,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Unassign

You can unassign one or more Tickets by id.

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
user_id required unassign string

Request

Route

PUT /v1/tickets/VePJlnobar

Headers

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

Body

{
  "auth_id": "xDjJBv1JoO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "user_id": "unassign"
}

cURL

curl "https://www.avochato.com/v1/tickets/VePJlnobar" -d '{"auth_id":"xDjJBv1JoO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","user_id":"unassign"}' -X PUT \
	-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: 0d9f7dc0-368d-453d-9618-843e64f6f4d8
X-Runtime: 0.039487
Content-Length: 362

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "VePJlnobar",
        "uuid": "eca4ca60-b346-49ee-991d-74e8af14d177",
        "contact": "KRg805Bbj0",
        "user_id": null,
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319686.095975,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Update Assignment with user_email

You can assign a User to be the owner of one or more Tickets by email.

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
user_email User email of the new owner string

Request

Route

PUT /v1/tickets/ZMvbXLKbRm%2CKRg803BJj0

Headers

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

Body

{
  "auth_id": "ezjJ7L185y",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "user_email": "person_32@example.com"
}

cURL

curl "https://www.avochato.com/v1/tickets/ZMvbXLKbRm%2CKRg803BJj0" -d '{"auth_id":"ezjJ7L185y","auth_secret":"YYYYYYYYYYYYYYYYYYYY","user_email":"person_32@example.com"}' -X PUT \
	-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: 78912373-9021-48d7-9512-bddaf9b92ce1
X-Runtime: 0.082603
Content-Length: 709

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "KRg803BJj0",
        "uuid": "a0714da0-7494-4ed2-915d-448c583dc2c6",
        "contact": "BLP9MQj9qY",
        "user_id": "qxk9EpBbRK",
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1638319685.8898518,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      },
      {
        "id": "ZMvbXLKbRm",
        "uuid": "8402b67a-e760-4f72-a829-bf6195a19703",
        "contact": "WAnJQwvby1",
        "user_id": "qxk9EpBbRK",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319685.909417,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Update Assignment with user_id

You can assign a User to be the owner of one or more Tickets by id.

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
user_id User ID of the new owner string

Request

Route

PUT /v1/tickets/0nMJLoK9vZ%2CWAnJQ2v8y1

Headers

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

Body

{
  "auth_id": "VePJlvKbar",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "user_id": "M3NbrrObr6"
}

cURL

curl "https://www.avochato.com/v1/tickets/0nMJLoK9vZ%2CWAnJQ2v8y1" -d '{"auth_id":"VePJlvKbar","auth_secret":"YYYYYYYYYYYYYYYYYYYY","user_id":"M3NbrrObr6"}' -X PUT \
	-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: 681b3b6f-d195-4cd5-ae7b-d060d99c608a
X-Runtime: 0.088062
Content-Length: 708

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "WAnJQ2v8y1",
        "uuid": "aeeae3f5-5cc6-40bc-9ba6-c0f815a8e84a",
        "contact": "enL8a4aJ7N",
        "user_id": "M3NbrrObr6",
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1638319685.697275,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      },
      {
        "id": "0nMJLoK9vZ",
        "uuid": "56971879-67aa-4874-b73e-6a67a7c10ddf",
        "contact": "PxB9NL28YO",
        "user_id": "M3NbrrObr6",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319685.719913,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Ticket Status

Ticket Status represents the state of a conversation, and can be used to organize your inbox. Tickets marked as Closed are archived and do not appear in the inbox by default.

Close a Ticket

Mark one or more Tickets as Closed. Note: this will also automatically mark the ticket as ‘Addressed’

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
status Use the 'Closed' Status to close a ticket string

Request

Route

PUT /v1/tickets/Pe6beE2bXw

Headers

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

Body

{
  "auth_id": "EZA9PWlbrw",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "status": "Closed"
}

cURL

curl "https://www.avochato.com/v1/tickets/Pe6beE2bXw" -d '{"auth_id":"EZA9PWlbrw","auth_secret":"YYYYYYYYYYYYYYYYYYYY","status":"Closed"}' -X PUT \
	-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: abba16da-8f6d-4a2a-b9d9-e5ee6ded6595
X-Runtime: 0.065586
Content-Length: 371

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "Pe6beE2bXw",
        "uuid": "bfd1c8c0-8ae3-4217-b2e5-eab39da213ff",
        "contact": "EZA9P1lJrw",
        "user_id": "KRg80vk9j0",
        "unaddressed": false,
        "status": "Closed",
        "origin": "Avochato",
        "created_at": 1638319683.56532,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Update Status

You can update the status of one or more Tickets

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
status The current Ticket Status. Options include "New", Open", "Pending", "Closed" string

Request

Route

PUT /v1/tickets/EDR8zLk9A2%2CBDr8G1N9Pl

Headers

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

Body

{
  "auth_id": "3OLb4NqJ4Y",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "status": "Pending"
}

cURL

curl "https://www.avochato.com/v1/tickets/EDR8zLk9A2%2CBDr8G1N9Pl" -d '{"auth_id":"3OLb4NqJ4Y","auth_secret":"YYYYYYYYYYYYYYYYYYYY","status":"Pending"}' -X PUT \
	-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: 8e7f07ff-1b92-4709-94af-32a7fbaddf75
X-Runtime: 0.103536
Content-Length: 705

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "BDr8G1N9Pl",
        "uuid": "c0f7c75c-336c-46af-b080-11f6fa520711",
        "contact": "1K2b21Y8WR",
        "user_id": null,
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1638319683.2998421,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      },
      {
        "id": "EDR8zLk9A2",
        "uuid": "70687ff4-95e2-4b63-ad0e-400c8c2c160f",
        "contact": "Pe6beq2bXw",
        "user_id": "0nMJLZ4bvZ",
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1638319683.3245828,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Tickets

Tickets represent a unique conversation with a Contact in an Avochato Account.

Fetch Previous Tickets

You can fetch information about previous tickets by source ticket id

Endpoint

GET /v1/tickets/:id/previous

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL parameter) Source Ticket id string

Request

Route

GET /v1/tickets/enL8aWa97N/previous?auth_id=xlYJp3m9mw&auth_secret=YYYYYYYYYYYYYYYYYYYY

Headers

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

Query Parameters

auth_id=xlYJp3m9mw
auth_secret=YYYYYYYYYYYYYYYYYYYY

cURL

curl -g "https://www.avochato.com/v1/tickets/enL8aWa97N/previous?auth_id=xlYJp3m9mw&auth_secret=YYYYYYYYYYYYYYYYYYYY" -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: b92fc7d3-9d6b-4ddf-9127-d6ecd7c1d2f1
X-Runtime: 0.013011
Content-Length: 326

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "2jRbkGVb1P",
        "uuid": "6e12e570-463e-43c8-8e47-832549d77dd2",
        "channel": "sms",
        "contact": "ezjJ751b5y",
        "created_at": 1638319685.29014,
        "closed_at": 1638316085.28904,
        "user": {
          "id": "BLP9MZYJqY",
          "name": "Person 27"
        },
        "device_type": null,
        "option_data": null,
        "tags": [

        ],
        "account_subdomain": "account_39"
      }
    ]
  }
}

Fetch Tickets

You can fetch Tickets by ids

Endpoint

GET /v1/tickets/:ids

Parameters

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

Request

Route

GET /v1/tickets/zPG9yQQ9aO%2CGeAbZNLbDM?auth_id=GeAbZ1L8DM&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=GeAbZ1L8DM
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/tickets/zPG9yQQ9aO%2CGeAbZNLbDM?auth_id=GeAbZ1L8DM&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: bfc115ab-847b-40c0-8fff-f997aef7a6a4
X-Runtime: 0.012405
Content-Length: 708

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "GeAbZNLbDM",
        "uuid": "fa0b9f23-e0a7-491d-92cb-220efbb3896c",
        "contact": "xoWbq4W8qn",
        "user_id": "xDjJBZLJoO",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319684.645725,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      },
      {
        "id": "zPG9yQQ9aO",
        "uuid": "7a4b69f7-84bb-4d5a-9b26-68c0b447f46d",
        "contact": "GeAbZDLJDM",
        "user_id": null,
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1638319684.58943,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  },
  "page": 1
}

List all Tickets

You can retrieve a paginated list of all Tickets within an account

Endpoint

GET /v1/tickets

Parameters

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

Request

Route

GET /v1/tickets?auth_id=43y833D8VN&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=43y833D8VN
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/tickets?auth_id=43y833D8VN&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: 2d70b85e-310a-4a17-ab41-6f2244fbae36
X-Runtime: 0.022541
Content-Length: 710

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "ZMvbXL4bRm",
        "uuid": "9e968aa2-d6a6-4620-ac16-692566213b40",
        "contact": "v5D9RrW9VA",
        "user_id": "enL8aZdb7N",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319685.0057092,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      },
      {
        "id": "xlYJpvmbmw",
        "uuid": "625d655f-f999-4a3e-9f61-169002fff6c5",
        "contact": "xlYJp4mJmw",
        "user_id": null,
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1638319684.953911,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  },
  "page": 1
}

Search Tickets

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=wEG8jGYbQl&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1

Headers

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

Query Parameters

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

cURL

curl -g "https://www.avochato.com/v1/tickets?auth_id=wEG8jGYbQl&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: d4c64023-1c63-4dbd-bbbe-21cdacf5a194
X-Runtime: 0.020669
Content-Length: 379

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "ezjJ7d185y",
        "uuid": "b81660c6-a8a3-49a2-8c10-92a30966897b",
        "contact": "wd6Jm4p97m",
        "user_id": "PxB9NZ09YO",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319685.156822,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  },
  "page": 1
}

Update Unaddressed

You can mark a ticket as Addressed or Unaddressed automatically

Endpoint

PUT /v1/tickets/:ids

Parameters

Name Description type
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL parameter) Comma separated list of Ticket id(s) string
unaddressed Flag whether the current ticket remains unaddressed. True or False boolean

Request

Route

PUT /v1/tickets/wEG8jdY9Ql

Headers

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

Body

{
  "auth_id": "xoWbqMWbqn",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "unaddressed": false
}

cURL

curl "https://www.avochato.com/v1/tickets/wEG8jdY9Ql" -d '{"auth_id":"xoWbqMWbqn","auth_secret":"YYYYYYYYYYYYYYYYYYYY","unaddressed":false}' -X PUT \
	-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: 40eb44d9-564b-4fa5-8ccd-209f6e39daed
X-Runtime: 0.029543
Content-Length: 370

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "wEG8jdY9Ql",
        "uuid": "4a7cc54b-29a4-4118-98e5-862b0f42f313",
        "contact": "wEG8jpY9Ql",
        "user_id": "2jRbkNj81P",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1638319684.825065,
        "device_type": null,
        "device": null,
        "os": null,
        "os_version": null,
        "browser": null,
        "browser_version": null,
        "ip": null,
        "widget_referrer_url": null
      }
    ]
  }
}

Users

Users represent a unique user an Avochato Account.

List all Users

You can retrieve a paginated list of all Users within an account

Endpoint

GET /v1/users

Parameters

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

Request

Route

GET /v1/users?auth_id=Pe6beW2JXw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=Pe6beW2JXw
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/users?auth_id=Pe6beW2JXw&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: a70913cf-193a-434b-bea1-645ecffa8e57
X-Runtime: 0.024734
Content-Length: 251

Body

{
  "status": 200,
  "data": {
    "users": [
      {
        "email": "person_15@example.com",
        "id": "PxB9NZD9YO",
        "name": "Person 16"
      },
      {
        "email": "bob.mctest@test.com",
        "id": "BLP9MZgJqY",
        "name": "Bob McTest"
      },
      {
        "email": "other.bob@test.com",
        "id": "WAnJQZR8y1",
        "name": "Other Bob"
      }
    ]
  },
  "page": 1
}