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

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

Headers

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

Query Parameters

auth_id=1K2b2m48WR
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/accounts/test-account%2Caccount_26?auth_id=1K2b2m48WR&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: 48cc7d27-35a4-4805-b6fb-08a3e370aaa7
X-Runtime: 0.075737
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "webYqWdbaE",
        "subdomain": "account_26",
        "name": "Account 26",
        "phone": null,
        "created_at": "2019-09-09T14:51:24.050-07:00"
      },
      {
        "id": "kAJvDOzb0o",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2019-09-09T14:51:24.071-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=Pe6be6e9Xw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=Pe6be6e9Xw
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/accounts?auth_id=Pe6be6e9Xw&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: dfa1e6ce-93aa-4c34-8943-534ad11ee6d8
X-Runtime: 0.036842
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "YnbgnQy8ae",
        "subdomain": "account_27",
        "name": "Account 27",
        "phone": null,
        "created_at": "2019-09-09T14:51:24.186-07:00"
      },
      {
        "id": "LxJDvw4bn2",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2019-09-09T14:51:24.214-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)
name Name of the broadcast to set
via_tags Comma-separated list of contact tags to add to broadcast
via_contact_ids Comma-separated list of contact ids to add to broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to broadcast
via_field[field] String, either name ,phone ,phone_formatted ,email ,company ,street ,city ,state ,country ,zip ,priority ,opted_out, OR Custom Variable name
via_field[value] String, match all contacts with a given field which matches this value exactly

Request

Route

POST /v1/broadcasts

Headers

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

Body

{
  "auth_id": "PxB9NqabYO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty.jpg",
  "name": "My New Broadcast",
  "via_tags": "tag1,tag2",
  "via_contact_ids": "lYJplozJmw",
  "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":"PxB9NqabYO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty.jpg","name":"My New Broadcast","via_tags":"tag1,tag2","via_contact_ids":"lYJplozJmw","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: b2633620-ab01-434b-8de1-b0a3d27c5dba
X-Runtime: 0.352446
Content-Length: 304

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "xDjJBR1JoO",
      "name": "My New Broadcast",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty.jpg",
      "status": "initialized",
      "contacts_count": 0,
      "user": {
        "email": "person_4@example.com",
        "id": "ZA9Pl6x9rw",
        "name": "Person 4"
      },
      "pending_contacts_count": null
    }
  }
}

Fetch Broadcasts

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

Endpoint

GET /v1/broadcasts/:ids

Parameters

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

Request

Route

GET /v1/broadcasts/PxB9Nq2bYO%2CBLP9MWj8qY?auth_id=WAnJQ258y1&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=WAnJQ258y1
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/broadcasts/PxB9Nq2bYO%2CBLP9MWj8qY?auth_id=WAnJQ258y1&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: cf814f6f-aa5d-46b8-b9bf-33148423e11e
X-Runtime: 0.026858
Content-Length: 337

Body

{
  "status": 200,
  "data": {
    "broadcasts": [
      {
        "id": "PxB9Nq2bYO",
        "message": "5",
        "status": "initialized",
        "contacts_count": 1,
        "user": {
          "email": "person_6@example.com",
          "id": "Egb56Em9ej",
          "name": "Person 6"
        }
      },
      {
        "id": "BLP9MWj8qY",
        "message": "6",
        "status": "queued",
        "contacts_count": 0,
        "user": {
          "email": "person_6@example.com",
          "id": "Egb56Em9ej",
          "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/WAnJQ2v8y1/publish

Headers

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

Body

{
  "auth_id": "0nMJLo69vZ",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "schedule_for": 1568029874.762551,
  "asap": true
}

cURL

curl "https://www.avochato.com/v1/broadcasts/WAnJQ2v8y1/publish" -d '{"auth_id":"0nMJLo69vZ","auth_secret":"YYYYYYYYYYYYYYYYYYYY","schedule_for":1568029874.762551,"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: e93deb39-3354-46fa-bc78-a08648698d73
X-Runtime: 0.087561
Content-Length: 182

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "WAnJQ2v8y1",
      "message": "7",
      "status": "queued",
      "contacts_count": 1,
      "user": {
        "email": "person_7@example.com",
        "id": "PG9y35G8aO",
        "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)
name Name of the Broadcast to set
via_tags Comma-separated list of contact tags to add to broadcast
via_contact_ids Comma-separated list of contact ids to add to broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to broadcast
via_field[field] String, [:name, :phone, :phone_formatted, :email, :company, :street, :city, :state, :country, :zip, :priority, :opted_out], OR Custom Variable name
via_field[value] String, match all contacts with a given field which matches this value exactly

Request

Route

POST /v1/broadcasts/2jRbkGVb1P

Headers

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

Body

{
  "auth_id": "BLP9MW18qY",
  "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": "d6Jmzor87m",
  "via_phone_numbers": "+15105551234,+14155551234",
  "via_field[field]": "email",
  "via_field[value]": "bob@mctest.com"
}

cURL

curl "https://www.avochato.com/v1/broadcasts/2jRbkGVb1P" -d '{"auth_id":"BLP9MW18qY","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":"d6Jmzor87m","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: 8f4d4b3e-c62d-4d38-b4e7-c0b5e7762f72
X-Runtime: 0.133946
Content-Length: 304

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "2jRbkGVb1P",
      "name": "My Other Broadcast",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty2.jpg",
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_5@example.com",
        "id": "QL9WL6BJWq",
        "name": "Person 5"
      },
      "pending_contacts_count": 3
    }
  }
}

CallTokens

Create Call Token

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

Endpoint

POST /v1/calls

Parameters

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

Request

Route

POST /v1/calls

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/calls" -d '{"auth_id":"mQL9WWz9Wq","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: f197cdd7-b9d4-43ca-b22e-5b5ee836cf77
X-Runtime: 0.070595
Content-Length: 324

Body

{
  "status": 200,
  "data": {
    "call_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDpvdXRnb2luZz9hcHBTaWQ9bm90cmVhbCBzY29wZTpjbGllbnQ6aW5jb21pbmc_Y2xpZW50TmFtZT1Pb2JLYXZYSjdFIiwiaXNzIjoidHdpbGlvX2FjY291bnRfc2lkIiwibmJmIjoxNTY4MDY1ODg1LCJleHAiOjE1NjgxNTIyODV9.EsZPhq7rK7YE4yLiIkamIClSF6QSA_U2cPlAhf7UB3Q"
  }
}

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/5V9Vxp18lr%2C3NbrBo2br6?auth_id=3Ynbg6n8ae&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=3Ynbg6n8ae
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/contacts/5V9Vxp18lr%2C3NbrBo2br6?auth_id=3Ynbg6n8ae&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: c9f3e474-29cf-455b-8379-8d10b2621863
X-Runtime: 0.038441
Content-Length: 451

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "3NbrBo2br6",
        "name": "Bob McTest",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1568065280.15395,
        "tags": [
          "important"
        ]
      },
      {
        "id": "5V9Vxp18lr",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1568065880.16638
      }
    ]
  },
  "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=RkAJvB6J0o&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1568065819.829115&created_at%5Bto%5D=1568065939.82924&page=1

Headers

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

Query Parameters

auth_id=RkAJvB6J0o
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=name:Bob OR 'San Fran'
created_at={"from"=>"1568065819.829115", "to"=>"1568065939.82924"}
page=1

cURL

curl -g "https://www.avochato.com/v1/contacts?auth_id=RkAJvB6J0o&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1568065819.829115&created_at%5Bto%5D=1568065939.82924&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: 18b43d86-130d-46af-abd8-70dad9cee62f
X-Runtime: 0.053644
Content-Length: 241

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "N6bwZo18DM",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1568065879.78607
      }
    ]
  },
  "page": 1
}

Update Contact

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

Endpoint

POST /v1/contacts

Parameters

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

Request

Route

POST /v1/contacts

Headers

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

Body

{
  "auth_id": "AwebY1abaE",
  "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":"AwebY1abaE","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: 11c4f3ba-e970-42f3-bd66-9c8a55ece11d
X-Runtime: 0.166976
Content-Length: 261

Body

{
  "status": 200,
  "data": {
    "contact": {
      "id": "Rg80KmPJj0",
      "name": "New Contact",
      "phone": "+14155553333",
      "email": "contact@example.com",
      "city": "SF",
      "state": "CA",
      "company": "Example Inc.",
      "created_at": 1568065879.51517,
      "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/vnJA1d7JAD/events

Headers

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

Body

{
  "auth_id": "PDz9nxR8e3",
  "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/vnJA1d7JAD/events" -d '{"auth_id":"PDz9nxR8e3","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: e8b86a23-d960-491f-9a32-88afbb299fc5
X-Runtime: 0.162760
Content-Length: 304

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "jRbkREj81P",
      "account_id": "QR91DPobge",
      "ticket_id": "d6Jmzze87m",
      "contact_id": "vnJA1d7JAD",
      "type": "sale",
      "context": "Wanted a new watch ($99.99) with no warranty",
      "revenue": 99.99,
      "element_id": "BLP9Me9qYX",
      "element_type": "CustomEvent",
      "sent_at": 1568065881.2970262
    }
  }
}

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": "3o48O4xbeA",
  "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":"3o48O4xbeA","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: 41397ba3-39ec-4937-b4a5-23fcff46e704
X-Runtime: 0.146025
Content-Length: 317

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "nL8aAad87N",
      "account_id": "N6bwZKO8DM",
      "ticket_id": "ePJl77N9ar",
      "contact_id": "EnJdno3bRm",
      "type": "sale",
      "context": "Bought an avocado ($2) and was interested in a subscription",
      "revenue": 2.0,
      "element_id": "WAnJQmJy1v",
      "element_type": "CustomEvent",
      "sent_at": 1568065881.7054489
    }
  }
}

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

Headers

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

Body

{
  "auth_id": "1LxJDY58n2",
  "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/MvbX00jbRm/events" -d '{"auth_id":"1LxJDY58n2","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: 3dc36447-d417-4f25-a32a-19de6dfaca3e
X-Runtime: 0.271918
Content-Length: 306

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "DjJBnqLJoO",
      "account_id": "Rg80K4yJj0",
      "ticket_id": "MvbX00jbRm",
      "contact_id": "xk9ELDpbRK",
      "type": "sale",
      "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
      "revenue": 15.5,
      "element_id": "PxB9NV9YOy",
      "element_type": "CustomEvent",
      "sent_at": 1568065880.736846
    }
  }
}

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/zjJ766095y/events?auth_id=YOobKoob7E&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=YOobKoob7E
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/tickets/zjJ766095y/events?auth_id=YOobKoob7E&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: 89e7bb30-166d-4c75-851c-ff28f4d274d8
X-Runtime: 0.072819
Content-Length: 1885

Body

{
  "status": 200,
  "data": {
    "events": [
      {
        "account_id": "3NbrBvDbr6",
        "ticket_id": "zjJ766095y",
        "user_id": "xB9NQ60bYO",
        "status": "Closed",
        "element_id": "VePJl7Y9ar",
        "element_type": "StatusChange",
        "sent_at": 1568065882.0909078
      },
      {
        "account_id": "3NbrBvDbr6",
        "call_from": "+15551234567",
        "call_to": "+15558888888",
        "voicemail": null,
        "direction": "in",
        "call_status": "completed",
        "ended_at": null,
        "duration": 119,
        "segments": 2,
        "element_id": "0nMJLNkbvZ",
        "element_type": "Call",
        "sent_at": 1568065882.082963
      },
      {
        "uuid": "6d02d4d5-8241-4e5d-b1b9-971601f8676f",
        "account_id": "3NbrBvDbr6",
        "ticket_id": "zjJ766095y",
        "contact_id": "webYqpWbaE",
        "sender_id": "xB9NQ60bYO",
        "sender_type": "User",
        "direction": "out",
        "message": "Sorry in a meeting but can call afterwards",
        "segments": 1,
        "status": "queued",
        "error_code": 0,
        "created_at": 1568065882,
        "sent_at": 1568065882.072716,
        "element_id": "kvnJA7ObAD",
        "element_type": "SmsMessage"
      },
      {
        "uuid": "6b307875-e006-45a8-9955-4356dfccda25",
        "account_id": "3NbrBvDbr6",
        "ticket_id": "zjJ766095y",
        "contact_id": "webYqpWbaE",
        "sender_id": "xB9NQ60bYO",
        "sender_type": "User",
        "direction": "out",
        "message": "Hey there Bob let me know when we can talk!",
        "segments": 1,
        "status": "queued",
        "error_code": 0,
        "created_at": 1568065882,
        "sent_at": 1568065882.064888,
        "element_id": "qxk9ENBJRK",
        "element_type": "SmsMessage"
      },
      {
        "account_id": "3NbrBvDbr6",
        "call_from": "+15558888888",
        "call_to": "+15551234567",
        "voicemail": null,
        "direction": "out",
        "call_status": "completed",
        "ended_at": null,
        "duration": 10,
        "segments": 1,
        "element_id": "WAnJQzm8y1",
        "element_type": "Call",
        "sent_at": 1568065882.056449
      },
      {
        "account_id": "3NbrBvDbr6",
        "ticket_id": "zjJ766095y",
        "user_id": "xB9NQ60bYO",
        "status": "Open",
        "element_id": "wd6Jmzz87m",
        "element_type": "StatusChange",
        "sent_at": 1568065882.048938
      },
      {
        "account_id": "3NbrBvDbr6",
        "ticket_id": "zjJ766095y",
        "user_id": "xB9NQ60bYO",
        "owner_id": "xB9NQ60bYO",
        "element_id": "xlYJpq8mwM",
        "element_type": "OwnerChange",
        "sent_at": 1568065882.040971
      }
    ]
  }
}

Messages

Filter Messages via timestamp

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, Query to search Messages (default: iterate through all messages)
page Integer, Page to request
direction String, Direction of the message ("in" for received messages, "out" for sent messages)
status String, Message delivery status (ie: queued, delivered, undelivered, failed)
from String, Phone number message was sent from
to String, Phone number message was sent to
created_at[from] Unix timestamp, Select messages created after this date
created_at[to] Unix timestamp, Select messages created before this date (default: now)

Request

Route

GET /v1/messages?auth_id=M3Nbr319r6&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1568065817.458542&created_at%5Bto%5D=1568065937.458611&document=private

Headers

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

Query Parameters

auth_id=M3Nbr319r6
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=
status=delivered
from=+15105551234
to=+14155551234
created_at={"from"=>"1568065817.458542", "to"=>"1568065937.458611"}
document=private

cURL

curl -g "https://www.avochato.com/v1/messages?auth_id=M3Nbr319r6&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1568065817.458542&created_at%5Bto%5D=1568065937.458611&document=private" -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: 7504ca82-d97a-4843-a0e0-7efe620d785f
X-Runtime: 0.039760
Content-Length: 445

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "a6586861-600a-4e20-80ac-67305c6c5066",
        "account_id": "zjJ76zX95y",
        "ticket_id": "nMJLyyW8vZ",
        "contact_id": "Rg80KmeJj0",
        "to": "+14155551234",
        "from": "+15105551234",
        "direction": "in",
        "message": "I kept hearing that you had great service 😀!",
        "segments": 1,
        "status": "delivered",
        "error_code": 0,
        "created_at": 1568065877,
        "sent_at": 1568065877.3601549,
        "element_id": "WAnJQYOJy1",
        "element_type": "SmsMessage"
      }
    ]
  },
  "page": 1
}

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, Query to search Messages (default: iterate through all messages)
page Integer, Page to request
direction String, Direction of the message ("in" for received messages, "out" for sent messages)
status String, Message delivery status (ie: queued, delivered, undelivered, failed)
from String, Phone number message was sent from
to String, Phone number message was sent to
created_at[from] Unix timestamp, Select messages created after this date
created_at[to] Unix timestamp, Select messages created before this date (default: now)

Request

Route

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

Headers

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

Query Parameters

auth_id=0N6bwkvbDM
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=in
status=delivered
from=+15105551234
to=+14155551234
created_at={"from"=>"1568059876.7236962", "to"=>"1568065936.723861"}

cURL

curl -g "https://www.avochato.com/v1/messages?auth_id=0N6bwkvbDM&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&from=%2B15105551234&to=%2B14155551234&created_at%5Bfrom%5D=1568059876.7236962&created_at%5Bto%5D=1568065936.723861" -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: e7c38d88-8598-4a9c-8ee0-d3c79eba311a
X-Runtime: 0.092192
Content-Length: 445

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "db71dfef-d857-4dca-bd1e-45da845d02ed",
        "account_id": "ePJl7aa9ar",
        "ticket_id": "LP9MzzNJqY",
        "contact_id": "AnJQLpa9y1",
        "to": "+14155551234",
        "from": "+15105551234",
        "direction": "in",
        "message": "I kept hearing that you had great service 😀!",
        "segments": 1,
        "status": "delivered",
        "error_code": 0,
        "created_at": 1568065876,
        "sent_at": 1568065876.6251462,
        "element_id": "PxB9NE0bYO",
        "element_type": "SmsMessage"
      }
    ]
  },
  "page": 1
}

Send Message

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

Endpoint

POST /v1/messages

Parameters

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

Request

Route

POST /v1/messages

Headers

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

Body

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

cURL

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

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 094e5a64-1290-488f-9fbf-cc16e64b73fc
X-Runtime: 0.259868
Content-Length: 479

Body

{
  "status": 200,
  "data": {
    "message": {
      "uuid": "695ddad4-5c09-499d-ab4c-d049a4888523",
      "account_id": "d6JmzNL87m",
      "ticket_id": "xB9NQQYbYO",
      "contact_id": "LP9MzpNJqY",
      "sender_id": "eAbZvyQbDM",
      "sender_type": "User",
      "to": "+14155553333",
      "direction": "out",
      "message": "test message",
      "segments": 1,
      "carrier": "twilio",
      "status": "queued",
      "error_code": 0,
      "status_callback": "http://my.domain.com",
      "created_at": 1568065875,
      "sent_at": 1568065875.877069,
      "element_id": "2jRbkMjJ1P",
      "element_type": "SmsMessage"
    }
  }
}

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/DjJBnYMJoO%2CzjJ76M095y/tags

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/contacts/DjJBnYMJoO%2CzjJ76M095y/tags" -d '{"auth_id":"qxk9EnkJRK","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: fb841781-da5e-44f2-b1d8-f18c8cdf2843
X-Runtime: 0.056398
Content-Length: 94

Body

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

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

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"NEnJdWx9Rm","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: 93bb1e13-8058-4cb0-9cb6-33a914b2ccaa
X-Runtime: 0.119340
Content-Length: 81

Body

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

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/nL8aApp87N%2CjRbkRo581P/tags

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/contacts/nL8aApp87N%2CjRbkRo581P/tags" -d '{"auth_id":"kvnJAl29AD","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: a42d7373-e5c4-441d-b059-a3ce91511321
X-Runtime: 0.068086
Content-Length: 96

Body

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

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

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"k5V9Vqeblr","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: 6b240bcf-e8df-4861-abd0-bbe9fd130122
X-Runtime: 0.125865
Content-Length: 83

Body

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

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/webYqqWbaE

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/tickets/webYqqWbaE" -d '{"auth_id":"zPG9yNWJaO","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: e757759b-e989-46f1-90ba-2ab9eb689867
X-Runtime: 0.128877
Content-Length: 234

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "webYqqWbaE",
        "uuid": "45e95df3-4334-4aca-9e0a-b37d280b977c",
        "contact": "Egb563X9ej",
        "user_id": "kAJvD5db0o",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1568065886.180622
      }
    ]
  }
}

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/Ynbgnnx8ae

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/tickets/Ynbgnnx8ae" -d '{"auth_id":"PweboGWbXm","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: 606c7d93-bbc2-44e8-9f0b-9fc23de381ae
X-Runtime: 0.131312
Content-Length: 227

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "Ynbgnnx8ae",
        "uuid": "ba2dea29-2b91-4ddb-a6b4-efefbbe02394",
        "contact": "weboadyJXm",
        "user_id": null,
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1568065886.6808572
      }
    ]
  }
}

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/NEnJdrpbRm%2CkvnJA0n9AD

Headers

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

Body

{
  "auth_id": "enL8aMY87N",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "user_email": "person_6@example.com"
}

cURL

curl "https://www.avochato.com/v1/tickets/NEnJdrpbRm%2CkvnJA0n9AD" -d '{"auth_id":"enL8aMY87N","auth_secret":"YYYYYYYYYYYYYYYYYYYY","user_email":"person_6@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: 214cc9f1-8d27-4754-9814-f36cf4ba6104
X-Runtime: 0.631097
Content-Length: 436

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "kvnJA0n9AD",
        "uuid": "d91a463b-15f2-41ed-9cb2-a6ed22906483",
        "contact": "xlYJpWL9mw",
        "user_id": "Pe6beyEbXw",
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1570668334.768474
      },
      {
        "id": "NEnJdrpbRm",
        "uuid": "68cedfd1-def7-4374-9d4a-a228290af8e3",
        "contact": "v5D9RNx9VA",
        "user_id": "Pe6beyEbXw",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1570668334.780363
      }
    ]
  }
}

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/RkAJvWW80o%2CAwebY7mJaE

Headers

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

Body

{
  "auth_id": "PxB9NzD9YO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "user_id": "EZA9PPx9rw"
}

cURL

curl "https://www.avochato.com/v1/tickets/RkAJvWW80o%2CAwebY7mJaE" -d '{"auth_id":"PxB9NzD9YO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","user_id":"EZA9PPx9rw"}' -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: d61e91a4-a490-41c3-bdd8-c76d6d443ecb
X-Runtime: 0.633121
Content-Length: 437

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "AwebY7mJaE",
        "uuid": "caf8b8e0-b2e3-41bf-a528-f27f806d1e1d",
        "contact": "ZMvbXwO8Rm",
        "user_id": "EZA9PPx9rw",
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1570668336.0399292
      },
      {
        "id": "RkAJvWW80o",
        "uuid": "3cff8aae-fb87-457b-af14-bdd1870eb19d",
        "contact": "wd6JmdP97m",
        "user_id": "EZA9PPx9rw",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1570668336.071455
      }
    ]
  }
}

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/5V9Vxx18lr

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/tickets/5V9Vxx18lr" -d '{"auth_id":"EZA9PxP9rw","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: 0d0e7a5c-3e4b-4703-affc-d73ef028ee43
X-Runtime: 0.117987
Content-Length: 236

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "5V9Vxx18lr",
        "uuid": "cad003d9-7277-4d9c-a7c0-1ea86f23f188",
        "contact": "e6beaMdbXw",
        "user_id": "5V9Vx2r8lr",
        "unaddressed": false,
        "status": "Closed",
        "origin": "Avochato",
        "created_at": 1568065884.991046
      }
    ]
  }
}

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/N6bwZZ18DM%2CQR91DDEbge

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/tickets/N6bwZZ18DM%2CQR91DDEbge" -d '{"auth_id":"3OLb47a84Y","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: a19825d5-3c8d-4aaf-bc42-9e44a7c22333
X-Runtime: 0.212168
Content-Length: 432

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "QR91DDEbge",
        "uuid": "77b508c3-f7bc-46cd-9f8d-0a6d77b0e214",
        "contact": "Dr8GnGDJPl",
        "user_id": null,
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1568065884.373004
      },
      {
        "id": "N6bwZZ18DM",
        "uuid": "9fc90a18-b2c1-42c4-8b23-bcd4883b6a47",
        "contact": "DR8zM2AJA2",
        "user_id": "3NbrB5Obr6",
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1568065884.3834639
      }
    ]
  }
}

Tickets

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

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/jRbkRR581P%2CDjJBnnMJoO?auth_id=v7Mb6qQ8ER&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=v7Mb6qQ8ER
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/tickets/jRbkRR581P%2CDjJBnnMJoO?auth_id=v7Mb6qQ8ER&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: 6c00f011-bd52-4f38-b670-b2b755df9ee0
X-Runtime: 0.077715
Content-Length: 437

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "jRbkRR581P",
        "uuid": "c6239285-ecd9-4983-987f-e0d053485a10",
        "contact": "Ynbgnox8ae",
        "user_id": "LP9Mz6YJqY",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1568065882.30256
      },
      {
        "id": "DjJBnnMJoO",
        "uuid": "70d012ed-043f-4374-9fcf-1e823e434225",
        "contact": "kAJvDorb0o",
        "user_id": null,
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1568065882.2927191
      }
    ]
  },
  "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=EDR8zAZJA2&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=EDR8zAZJA2
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl -g "https://www.avochato.com/v1/tickets?auth_id=EDR8zAZJA2&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: 327c9d7d-a450-48df-ae0c-8dd83a528db1
X-Runtime: 0.031381
Content-Length: 437

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "Rg80KKPJj0",
        "uuid": "49e3a468-8c89-4f99-860e-ac94cf5709d4",
        "contact": "1N8xD21837",
        "user_id": "Rg80K0zJj0",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1568065883.627521
      },
      {
        "id": "nMJLyyE8vZ",
        "uuid": "913721a1-9c2f-4cb0-862b-4c05f7417128",
        "contact": "7Mb6Wok9ER",
        "user_id": null,
        "unaddressed": false,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1568065883.621529
      }
    ]
  },
  "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=z1N8xapb37&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1

Headers

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

Query Parameters

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

cURL

curl -g "https://www.avochato.com/v1/tickets?auth_id=z1N8xapb37&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: a7f7e706-becd-4ba8-9d1e-38cfaf712530
X-Runtime: 0.041097
Content-Length: 244

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "xB9NQQWbYO",
        "uuid": "716ef00b-2448-40e4-9556-a95fe4ef4032",
        "contact": "Dz9nVpk9e3",
        "user_id": "AnJQLqO9y1",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1568065882.8248682
      }
    ]
  },
  "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/AnJQLLw9y1

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/tickets/AnJQLLw9y1" -d '{"auth_id":"BDr8GlYbPl","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: c5ad23d0-ed4a-45fb-8f82-18e64ca98063
X-Runtime: 0.026254
Content-Length: 234

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "id": "AnJQLLw9y1",
        "uuid": "ef0ab9c8-cb49-48e9-acaf-419f10d93a6c",
        "contact": "OobKaGaJ7E",
        "user_id": "nMJLyWp8vZ",
        "unaddressed": false,
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1568065883.253504
      }
    ]
  }
}