{
	"info": {
		"_postman_id": "625a0bb2-14ef-409c-ba11-f567b270da7d",
		"name": "SarvCRM API Version 5",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "26112614",
		"_collection_link": "https://sarvcrm.postman.co/workspace/SarvCRM-Methods~28133088-076e-4cf7-9664-53200e40d902/collection/26112614-625a0bb2-14ef-409c-ba11-f567b270da7d?action=share&creator=26112614&source=collection_link"
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Login",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"auth": {
							"type": "noauth"
						},
						"method": "POST",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "utype",
									"value": "{{SUBSCRIPTION_NAME}}",
									"type": "text"
								},
								{
									"key": "username",
									"value": "{{USERNAME}}",
									"type": "text"
								},
								{
									"key": "password",
									"value": "{{MD5_PASSWORD}}",
									"type": "text"
								},
								{
									"key": "login_type",
									"value": "portal",
									"type": "text",
									"disabled": true
								}
							]
						},
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Login",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Login"
								}
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "CRUD",
			"item": [
				{
					"name": "Create a lead",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "first_name",
									"value": "Joel",
									"type": "text"
								},
								{
									"key": "last_name",
									"value": "Miller",
									"type": "text"
								},
								{
									"key": "type",
									"value": "Individual",
									"type": "text"
								},
								{
									"key": "lead_source",
									"value": "Conference",
									"type": "text"
								},
								{
									"key": "status",
									"value": "New",
									"type": "text"
								},
								{
									"key": "numbers",
									"value": "[{\"type\":\"Mobile\",\"number\":\"09121111234\",\"phoneCode\":\"+98\",\"phoneFlag\":\"IR\",\"primary\":\"1\",\"sms\":\"1\",\"fax\":\"0\"}, \"02122225678\", \"09125822020\"]",
									"type": "text"
								},
								{
									"key": "lineitems",
									"value": "[{\"product_id\": \"5c90759f-d362-0ddc-da11-61d15ce941bb\"}, {\"product_id\": \"cee52aad-4e1f-f974-48c0-62270ef2e7f5\", \"product_qty\": 7, \"discount\": \"Percentage\", \"product_discount\": 30, \"vat\": 9, \"description\": \"\", \"item_description\": \"\"}]",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Save&module=Leads",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Save"
								},
								{
									"key": "module",
									"value": "Leads"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Retrieve an account",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Retrieve&module=Accounts&id={{ACCOUNT_ID}}",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Retrieve"
								},
								{
									"key": "module",
									"value": "Accounts"
								},
								{
									"key": "id",
									"value": "{{ACCOUNT_ID}}"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Update a lead",
					"request": {
						"method": "PUT",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "first_name",
									"value": "Joel",
									"type": "text"
								},
								{
									"key": "last_name",
									"value": "Miller",
									"type": "text"
								},
								{
									"key": "type",
									"value": "Individual",
									"type": "text"
								},
								{
									"key": "lead_source",
									"value": "Conference",
									"type": "text"
								},
								{
									"key": "status",
									"value": "New",
									"type": "text"
								},
								{
									"key": "numbers",
									"value": "[{\"type\":\"Mobile\",\"number\":\"09121111234\",\"phoneCode\":\"+98\",\"phoneFlag\":\"IR\",\"primary\":\"1\",\"sms\":\"1\",\"fax\":\"0\"}, \"02122225678\", \"09125822020\"]",
									"type": "text"
								},
								{
									"key": "numbers",
									"value": "[\"09121111234\",\"02122225678\"]",
									"type": "text",
									"disabled": true
								}
							]
						},
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Save&module=Leads&id={{LEAD_ID}}",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Save"
								},
								{
									"key": "module",
									"value": "Leads"
								},
								{
									"key": "id",
									"value": "{{LEAD_ID}}"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Delete a lead",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Save&module=Leads&id={{LEAD_ID}}",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Save"
								},
								{
									"key": "module",
									"value": "Leads"
								},
								{
									"key": "id",
									"value": "{{LEAD_ID}}"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Retrieve [With Parameters]",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "id",
									"value": "{{ACCOUNT_ID}}",
									"type": "text",
									"disabled": true
								},
								{
									"key": "selected_fields[]",
									"value": "id",
									"type": "text"
								},
								{
									"key": "selected_fields[]",
									"value": "name",
									"type": "text"
								},
								{
									"key": "query",
									"value": "accounts.name LIKE \"%مریم%\"",
									"type": "text"
								},
								{
									"key": "order_by",
									"value": "accounts.date_entered",
									"type": "text"
								},
								{
									"key": "offset",
									"value": "0",
									"type": "text"
								},
								{
									"key": "max_results",
									"value": "10",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Retrieve&module=Accounts",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Retrieve"
								},
								{
									"key": "module",
									"value": "Accounts"
								}
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Other methods",
			"item": [
				{
					"name": "GetModuleFields",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=GetModuleFields&module=Accounts",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "GetModuleFields"
								},
								{
									"key": "module",
									"value": "Accounts"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Relation Records",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=GetRelationship&module=Accounts&id={{ACCOUNT_ID}}&related_field=opportunities",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "GetRelationship"
								},
								{
									"key": "module",
									"value": "Accounts"
								},
								{
									"key": "id",
									"value": "{{ACCOUNT_ID}}"
								},
								{
									"key": "related_field",
									"value": "opportunities"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Relation Records [With Parameters]",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "related_field",
									"value": "opportunities",
									"type": "text"
								},
								{
									"key": "selected_fields[]",
									"value": "id",
									"type": "text"
								},
								{
									"key": "selected_fields[]",
									"value": "name",
									"type": "text"
								},
								{
									"key": "query",
									"value": "opportunities.name LIKE \"%مریم%\"",
									"type": "text"
								},
								{
									"key": "order_by",
									"value": "opportunities.date_entered",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=GetRelationship&module=Accounts&id={{ACCOUNT_ID}}",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "GetRelationship"
								},
								{
									"key": "module",
									"value": "Accounts"
								},
								{
									"key": "id",
									"value": "{{ACCOUNT_ID}}"
								}
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Examples",
			"item": [
				{
					"name": "Get Survey Questions",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Retrieve&module=Surveys&id={{SURVEY_ID}}&selected_fields[]=questions",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Retrieve"
								},
								{
									"key": "module",
									"value": "Surveys"
								},
								{
									"key": "id",
									"value": "{{SURVEY_ID}}"
								},
								{
									"key": "selected_fields[]",
									"value": "questions"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Note Attachment",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Retrieve&module=Notes&id={{NOTE_ID}}&selected_fields[]=file_content",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Retrieve"
								},
								{
									"key": "module",
									"value": "Notes"
								},
								{
									"key": "id",
									"value": "{{NOTE_ID}}"
								},
								{
									"key": "selected_fields[]",
									"value": "file_content"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Get Document Attachment",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjg2MTE1ODg0LCJleHAiOjE2ODY3MjA2ODQsImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6W10sInVzZXJfaWQiOiI0NDE2YmZkYS00ZDYyLWU4YWUtZTk5Ny02NDU4ZTMwNGQwMjgifX0.QLa7nMXg7XDb5PIZQzRg2H7oEVWs3WS61xB6gIXxZ6E",
								"type": "text"
							},
							{
								"key": "",
								"value": "",
								"type": "text",
								"disabled": true
							}
						],
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Retrieve&module=Documents&id={{DOCUMENT_ID}}&selected_fields[]=file_content",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Retrieve"
								},
								{
									"key": "module",
									"value": "Documents"
								},
								{
									"key": "id",
									"value": "{{DOCUMENT_ID}}"
								},
								{
									"key": "selected_fields[]",
									"value": "file_content"
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Leave a comment",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "parent_type",
									"value": "Leads",
									"type": "text"
								},
								{
									"key": "parent_id",
									"value": "ca86cc27-697a-be0a-ec1e-60f51a4c1146",
									"type": "text"
								},
								{
									"key": "description",
									"value": "HELLO",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "https://app.sarvcrm.com/API.php?method=Save&module=Comments",
							"protocol": "https",
							"host": [
								"app",
								"sarvcrm",
								"com"
							],
							"path": [
								"API.php"
							],
							"query": [
								{
									"key": "method",
									"value": "Save"
								},
								{
									"key": "module",
									"value": "Comments"
								}
							]
						}
					},
					"response": []
				}
			]
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzYXJ2ZW5vIiwiaWF0IjoxNjkwMDA2MjM5LCJleHAiOjE2OTA2MTEwMzksImRhdGEiOnsiZnVsbF9uYW1lIjoiXHUwNjQ1XHUwNjJkXHUwNjMzXHUwNjQ2IFx1MDY0Mlx1MDYyZlx1MDZjY1x1MDY0NSBcdTA2N2VcdTA2NDhcdTA2MzEiLCJwcmVmZXJlbmNlcyI6bnVsbCwidXNlcl9pZCI6IjZiYjY2ZjAxLTU2NjItZmUyNy0xYTkyLTU5OWFjZDE1MDJmYiIsInV0eXBlIjoic2FydmVubyJ9fQ.N7z6iWeC6_gCAqkGIeaYvG36NrWBoZDbFiRic7k1Lmk",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	]
}