{
    "swagger": "2.0",
    "info": {
        "description": "**NOTE:** All API calls contain 2 parameters - 'api_key' and 'team_id'. These can be inferred from your settings page 'https://app.sendx.io/setting' under the sections 'Api Key' and 'Team Id' respectively.\n\nFor checking language specific Clients:\n-  [Golang](https://github.com/sendx/sendx-api-go)\n-  [Python](https://github.com/sendx/sendx-api-python)\n-  [Ruby](https://github.com/sendx/sendx-api-ruby)\n-  [Java](https://github.com/sendx/sendx-api-java)\n-  [PHP](https://github.com/sendx/sendx-api-php)\n-  [NodeJS](https://github.com/sendx/sendx-api-nodejs)\n\nWe also have a [Javascript API](http://help.sendx.io/knowledge_base/topics/javascript-api-1) for client side integrations.\n\nSendX REST API has two methods:\n\n  * Identify\n  * Track\n\n  ## Identify API Method\n\n  Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it.\n\n  **Example Request:**\n  \n\n  ```json\n     {\n        email: \"john.doe@gmail.com\",\n        firstName: \"John\",\n        lastName: \"Doe\",\n        birthday: \"1989-03-03\",\n        customFields: {\n          \"Designation\": \"Software Engineer\",\n          \"Age\": \"27\",\n          \"Experience\": \"5\"\n        },\n        tags: [\"Developer\", \"API Team\"]\n     }\n  ```\n  \n  \n  Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact.\n  \n  Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact.\n\n  Custom Fields are associated with data types and which be created and edited inside the app. If a custom field is not present inside the app and an API call is made containing it, a custom field with type 'string' is created and the value set. For custom fields with data type 'number', values can be added to or subtracted from existing values. This can be done by using \"++\" or \"--\" operator before the number(e.g. \"customField_name\": \"++34\" would increase the value of existing \"customField_name\" in SendX for the contact. If it doesn't already exist, the value '34' would be inserted for it).\n  \n  We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like:\n  \n  \n  **API Call A**\n   \n\n  ```json\n     {\n        email: \"john.doe@gmail.com\",\n        firstName: \"John\",\n        birthday: \"1989-03-03\",\n        customFields: {\n          \"Designation\": \"Software Engineer\"\n        },\n        tags: [\"Developer\"]\n     }\n  ```\n  \n  \n  **API Call B**\n  \n\n  ```json\n     {\n        email: \"john.doe@gmail.com\",\n        customFields: {\n          \"Age\": \"29\"\n        },\n        tags: [\"API Team\"]\n     }\n  ```\n  \n  \n  Then the final contact will have firstName as **John**, birthday as **1989-03-03** present. Also both tags **Developer** and **API Team** shall be present along with custom fields **Designation** and **Age**.\n  \n  \n  **Properties:**\n  \n  * **firstName**: type string\n  * **lastName**: type string\n  * **email**: type string  \n  * **newEmail**: type string  \n  * **company**: type string  \n  * **birthday**: type string with format **YYYY-MM-DD** eg: 2016-11-21  \n  * **customFields**: type map[string]string   \n  * **tags**: type array of string \n\n\n\n  In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property.\n\n  \n  \n  **Response:**\n  \n\n  ```json\n     {\n        \"status\": \"200\",\n        \"message\": \"OK\",\n        \"data\": {\n          \"encryptedTeamId\": \"CLdh9Ig5GLIN1u8gTRvoja\",\n          \"encryptedId\": \"c9QF63nrBenCaAXe660byz\",\n          \"tags\": [\n            \"API Team\",\n            \"Tech\"\n          ],\n          \"firstName\": \"John\",\n          \"lastName\": \"Doe\",\n          \"email\": \"john.doe@gmail.com\",\n          \"company\": \"\",\n          \"birthday\": \"1989-03-03\",\n          \"customFields\": {\n            \"Age\": \"29\",\n            \"Designation\": \"Software Engineer\"\n          }  \n        }  \n     }\n  ```\n  \n  \n  ## Track API Method\n  \n  Track API Method is used to track a contact. In the track API object you can:\n  \n  * **addTags**:\n  * **removeTags**:\n  \n  You can have automation rules based on tag addition as well as tag removal and they will get executed. For eg:\n  \n  * On **user registration** tag start onboarding drip for him / her.\n  * **Account Upgrade** tag start add user to paid user list and start account expansion drip. \n  * On removal of **trial user** tag start upsell trial completed users drip.\n  \n  \n  **Example Request:**\n  \n  >\n    \\_scq.push([\"track\", {\n       \"addTags\": [\"blogger\", \"female\"]\n    }]);  \n  \n  \n  >\n    \\_scq.push([\"track\", {\n       \"addTags\": [\"paid user\"],\n       \"removeTags\": [\"trial user\"]\n    }]);  \n  \n  \n  **Response:**\n  \n  >\n     {\n      \"status\": \"200\",\n      \"message\": \"OK\",\n      \"data\": \"success\"\n     }\n",
        "version": "v1",
        "title": "SendX REST API"
    },
    "host": "app.sendx.io",
    "basePath": "/api/v1",
    "tags": [
        {
            "name": "Contact"
        }
    ],
    "schemes": [
        "https"
    ],
    "consumes": [
        "application/json"
    ],
    "produces": [
        "application/json"
    ],
    "paths": {
        "/contact/identify": {
            "post": {
                "tags": [
                    "Contact"
                ],
                "summary": "Identify a contact as user",
                "description": "",
                "parameters": [
                    {
                        "name": "api_key",
                        "in": "header",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "team_id",
                        "in": "query",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "in": "body",
                        "name": "Contact Details",
                        "description": "Contact details",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/ContactRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The created Contact object",
                        "schema": {
                            "$ref": "#/definitions/ContactResponse"
                        }
                    }
                }
            }
        },
        "/contact/track": {
            "post": {
                "tags": [
                    "Contact"
                ],
                "summary": "Add tracking info using tags to a contact",
                "description": "",
                "parameters": [
                    {
                        "name": "api_key",
                        "in": "header",
                        "type": "string",
                        "required": true,
                        "description": ""
                    },
                    {
                        "name": "team_id",
                        "in": "query",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "description": "",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "Track Details",
                        "in": "body",
                        "description": "Track Details",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/TrackRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success response for tag addition",
                        "schema": {
                            "$ref": "#/definitions/TrackResponse"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "ContactRequest": {
            "type": "object",
            "required": [
                "email"
            ],
            "properties": {
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "newEmail": {
                    "type": "string"
                },
                "company": {
                    "type": "string"
                },
                "birthday": {
                    "type": "string"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "customFields": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                }
            }
        },
        "Contact": {
            "type": "object",
            "properties": {
                "encryptedTeamId": {
                    "type": "string"
                },
                "encryptedId": {
                    "type": "string"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "company": {
                    "type": "string"
                },
                "birthday": {
                    "type": "string"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "customFields": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                }
            }
        },
        "ContactResponse": {
            "type": "object",
            "properties": {
                "status": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "data": {
                    "$ref": "#/definitions/Contact"
                }
            }
        },
        "TrackRequest": {
            "type": "object",
            "properties": {
                "addTags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "removeTags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "TrackResponse": {
            "type": "object",
            "properties": {
                "status": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                }
            }
        }
    }
}