{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"25d40fb8-5449-402b-82d0-a6ae74391a71","name":"Teamgate API Documentation","description":"<br>\n<img src=\"https://www.teamgate.com/wp-content/uploads/files/teamgate_logoBlue.png\" width=\"75%\">\n<br>\n\n# Getting Started with Teamgate API\nThis documentation will help you to get started with RESTful Teamgate API. Out API receives and parses CORS (Cross-Origin Resource Sharing) requests and returns results in JSON format. Every request must have application key (APP_KEY) and users AUTH_TOKEN.\n\n***\n\n# Application Key\nApplication key is a unique sequence of symbols, assigned to your app by request. You should set APP_KEY in every API request. By this key we determine whether your application has rights to send requests to our API. APP_KEY should be added to every request's header as „X-App-Key” parameter.<br><br>\n![alt text](https://files.readme.io/a845672-external_apps.png \"App Key\")\n<br><br>\n\n***\n\n# Authorization Token\nUnique authorization token is being generated to every user in Teamgate. You can find it in your profile or by using API method „authorization” (see http://developers.teamgate.com/). This token is used to determine user in our system and should be set in every request's header as „X-Auth-Token” parameter.<br><br>\n![alt text](https://files.readme.io/71dd920-example_auth_token-2.png \"App Key\")\n<br><br>\nMy Profile -> Integrations -> AUTH_TOKEN\n\n***\n\n# Users Permissions\nEvery request should have APP_KEY as header parameter „**X-App-Key**” and user's AUTH_TOKEN as header parameter „**X-Auth-Token**”. By these parameters Teamgate API checks permissions whether user can call specified API method. Users permissions are set using roles tree in your account settings (Settings → Users Management → User Roles).\n\n***\n\n# Making API Request\nTeamgate API uses simple URL rules. Every request should have APP_KEY and AUTH_TOKEN. API URL for all requests is https://api.teamgate.com/. Simply add to url controller, action and parameters required by action (e.g. controller: sales, action getSalesUdfList – https://api.teamgate.com/sales/getSalesUdfList). All requests should be sent by POST, GET, PUT or DELETE methods. Also, don't forget to add APP_KEY and AUTH_TOKEN as header parameters. APP_KEY is passed with header parameter „**X-App-Key**“, AUTH_TOKEN is passed with header parameter „**X-Auth-Token**“. Result is returned in JSON format, for example {\"success\":true,\"data\":{the_data}}. Success would have true or false values.\n\n***\n\n# Querying a collection\n\nA collection is read with a GET operation. Data from the query is returned in the JSON format unless specified otherwise in the individual reference. You can specify a supported data format with an ACCEPT header.\n\nA GET request that returns a large amount of data can stress the database server and cause performance degradation for all users. To minimize the load:\n\n- Specify how the returned data are paged.\n- Retrieve only the fields you need by using a fields clause.\n- Filter the instances to be returned with a query clause.\n\n## Page data (limit, offset, count)\n\nWhen a query returns a large set of data, the results are returned in a series of pages. The client requests the next page after handling the data already received.\n\nPagination lets you: \n\n- Retrieve a limited collection of results from the server.\n\n- Offset a collection of results from the server.\n\nTo paginate, use the keywords limit and offset.\n\n### Limit: Specifying the page size in the query\n\nYou can indicate the number of instances to return in each page using the query parameter.\n\nlimit has the following syntax: limit=`<value>`\n\nThe `value` is an integer and must be greater than 0.\n\nThis limits the number of results in a resource collection returned from the server to a specific number of results.\n\nThe count property in the response states the actual number of entities that answer the filter (including the ones that are brought by the specific page).\n\nIf no limit parameter is provided, the default limit is used.\n\n### Offset: Specifying where to start a page\n\nThe query parameter offset sets the first position to return from the results of the query. The default is 0, which starts the page at the first result.\n\nOffset has the following syntax: offset=`<value>`\n\nThe `value` is an integer and must be greater than or equal to 0.\n\nThis offsets the starting point of the collection returned from the server in the results.\n\nIf no offset parameter is provided, the number 0 is used.\n\n## Select fields (fields)\nYou can specify the fields to be returned from the server in the response to a GET operation on a collection.\n\nUsing the fields clause is useful when GETting certain fields that are not listed by default, often for performance reasons. Some examples are: user-defined fields, comments, attachments, runs, and run steps.\n\nThe fields parameter\n\nSelect fields with the fields parameter. The fields parameter has the following syntax: \n\nfields=`<field name>[[,<field name>]]`\n\nExample: /companies?fields=name,starred\n\nThe field's ID and type are always returned regardless of the fields you select.\n\nField names are separated by commas: ,\n\nIf no fields parameter is provided, a default set of fields is returned.\n\n## Sort results (order)\nSorts the entities returned from the server during a GET operation on collections.\n\nThe order_by parameter has the following syntax:\n\norder=`<field name>[[,[<direction>]<field name>]]:[<direction>]`\n\nExample: /companies?order=name:asc,starred:desc\n\nField names are separated by commas (,).\n\nIf no order parameter is sent, the collection is sorted by default.\n\nSorting is case-insensitive. This means that the values A B C D E a b c d e are sorted like this: A a B b C c D d E e .\n\nResults can be sorted by any fields of the entity.\n\nIf no order parameter is sent, the collection is sorted by entity ID.\n\n## Filtering\nFiltering supports any field of groups of fields. Combinational filtering can be used.\nSupported string comparison operators: `=`, `like`. `=` operator expects exact value, for example `?name=Piotr%20Newman`, while like operator, can match substring with the help of percentage encapsulation, like this:\n- `%end of string`, for example: `?name[like]=%Newman`\n- `start of string%`, for example `?name[like]=Piotr%`\n- `%somewhere in string%`, for example `?name[like]=%tr P%`\n\nSupported numerical operators:\n- `=` - equals, for example `?cost=20`, matches records with cost value equal to 20.\n- `gt` - greater than, for example `?cost[gt]=20`, matches records with greater cost than 20.\n- `lt` - less than, for example `?cost[lt]=100`, matches records with lesser than 100 cost.\n- `gte` - greater than or equal, for example `?cost[gte]=20`, matches records with greater or equal cost to 20.\n- `lte` - less than or equal, for example `?cost[lte]=100`, matches records with lesser or equal cost to 100.\n\nYou can use logic operators in single field multiple comparisons or for whole request with the help of operator parameter. For example:\n- Global logical operator - `?operator=or`\n- Per field logical operator - `?cost[operator]=or&cost[lt]=100&cost=500`\n\n***\n\n# Responses\nWith Teamgete API you can specify what fields you want to get from the response. This allows you to see only the relevant information. Just note that **Id** will always be shown. To do this just add additional information to the requested URL. If you want to see more than one field you will need to separete it with commas, as seen in example:\n\n```\nhttps://api.teamgate.com/v4/companies/{{companyId}}?fields=name,owner\n```\nIf you want to include custom fields in response just add `?embed=customFields` at the end of URL. See example:\n```\nhttps://api.teamgate.com/v4/leads/?embed=customFields\n```\nThis works with leads, people, companies, deals and products. Just change the leads to any other one you want.\n\nYou can also use **AND** and **OR operators**. Lets say you have two conditions that has to be satisfied. Than you can use the **default AND** operator.\n\nSee example: \n```\nhttps://api.teamgate.com/v4/leads?source=Web search&industry=Hardware Testing\n```\n\nBut lets say you want to have at least one of the condition satisfied then you can use **OR operator**.\n\nSee example: \n```\nhttps://api.teamgate.com/v4/leads?source=Web search&industry=Hardware Testing&operator=OR\n```\n***\n\n# API Request Limits\nRequest limiting of the API is primarily considered on a per-account — or more accurately described, per Application Key in your account. By default rate limit is **1000 requests** by Application Key **per 15 minutes**. If you want to increase the limit of API requests, please write to us at support@teamgate.com.\n<br>\nIf you're getting '193' response code, that means you have made too many API requests in given time frame. Such limits are managed as an allowed number of operations per time window, where an operation might be read or an update.\n<br>\n## HTTP Headers and Response Codes\nIf you hit the rate limit on a given endpoint, this is the body of the HTTP 193 message that you will see:\n<br>\n**JSON**\n```JSON\n{\n    \"success\": false,\n    \"error\": \"API key request limit reached: 1000\",\n    \"code\": 193\n}\n```\n**Rate limit headers:**<br>\n**X-RateLimit-Limit**: Maximum number of operations allowed in the current window.<br>\n**X-RateLimit-Remaining**: Number of operations left in the current window.<br>\n**X-RateLimit-Reset**: Time when rate limit window will be reset as a Unix timestamp.\n\nAlso for leads, people, companies, deals and products you can see custom fields\n*** \n\n# Web SDK\n\nhttps://github.com/teamgate/php-sdk\n\n***\n\n# Errors\n\nTeamgate API uses HTTP and some custom response codes to indicate the success or failure of an API request.\n\nThe codes consist of 3 numbers. The first number generally denotes the type of error.\n\n19x codes means that something went wrong with authentication, 2xx codes generally indicate success, 4xx codes indicate a problem with the request that was sent, incorrect query parameter/syntax etc, 5xx codes means that something went wrong on the blog's server, and 7xx codes indicate internal application errors.\n\n## Error responses\n\nErrors are returned in JSON, with a top-level error keys `code` and `message`.\n\nEach error currently has a message and an error Type.\n\nThis error response format is likely to get an overhaul in the near future.\n\nExamples:\n<br>\n**JSON**\n```JSON\n{\n    \"success\": false,\n    \"error\": \"API key request limit reached: 1000\",\n    \"code\": 193\n}\n```\n```JSON\n{\n  \"success\": false,\n  \"error\": \"Url invalid\",\n  \"code\": 750\n}\n```\n\n\n## HTTP success/error codes used:\n\n\n| Code      | Message          | \n| ------------- |:-------------:|\n| 190 | APP_KEY_NOT_FOUND |\n| 191 | APP_KEY_INVALID |\n| 192 | APP_NOT_ACTIVE |\n| 193 | API key request limit reached: xxxx |\n| 194 | URL_INVALID |\n| 196 | ACCOUNT_EXPIRED |\n| 197 | USER_TOKEN_INVALID |\n| 198 | USERNAME_OR_PASSWORD_INVALID |\n| 199 | GATEWAY_ERROR |\n| 200 | OK. Response for successful HTTP requests.  |\n| 201 | Created. The request has been fulfilled, resulting in the creation of a new resource. |\n| 400 | Bad Request. The server cannot or will not process the request due to an apparent client error. |\n| 403 | Forbidden. The request was a valid request, but the server is refusing to respond to it. The user might be logged in but does not have the necessary permissions for the resource. |\n| 404 | Not Found. The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible. |\n| 405 | Method Not Allowed. A request method is not supported for the requested resource. |\n| 500 | Internal Server Error. A generic error message, given when an unexpected condition was encountered and no more specific message is suitable. |\n| 700 | REQUEST_TYPE |\n| 701 | APP_KEY |\n| 702 | API_KEY |\n| 703 | USERNAME_OR_PASSWORD |\n| 704 | USER_NOT_ACTIVE |\n| 705 | APP_NOT_ACTIVE |\n| 706 | QUERY_LIMIT |\n| 707 | ACCESS_TOKEN |\n| 708 | DB |\n| 709 | NO_APP_DATA |\n| 710 | NO_API_USERS_DATA |\n| 711 | WRONG_DATA |\n| 712 | NO_PERMISSIONS |\n| 713 | NOT_SECURE_CONNECTION |\n| 714 | WRONG_IP |\n| 715 | NO_APP_KEY |\n| 716 | DB_NAME_INVALID |\n| 717 | USER_NOT_FOUND |\n| 720 | DATA_LIMIT |\n| 750 | ACTION_ERROR |\n| 760 | DB_QUERY_ERROR |","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"4195728","team":102348,"collectionId":"25d40fb8-5449-402b-82d0-a6ae74391a71","publishedId":"RW87rW37","public":true,"publicUrl":"https://developers.teamgate.com","privateUrl":"https://go.postman.co/documentation/4195728-25d40fb8-5449-402b-82d0-a6ae74391a71","customColor":{"top-bar":"1A3347","right-sidebar":"112534","highlight":"3AA2C9"},"documentationLayout":"classic-double-column","version":"8.10.1","publishDate":"2018-05-22T10:30:51.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/cbee6ae93cf35f409819ecca3f8c0fe179eab86ac588d611bf8b4edd23bf2330","favicon":"https://teamgate.com/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://developers.teamgate.com/view/metadata/RW87rW37"}