{
	"info": {
		"name": "MAD API v3",
		"description": "Sauce Labs Mobile App Distribution — API v3\n\nSet the `base_url` and `api_key` variables before running requests.\n\nAll list endpoints support pagination via `page` and `per_page` query parameters.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "https://your-domain.com",
			"type": "string"
		},
		{
			"key": "api_key",
			"value": "YOUR_API_KEY",
			"type": "string"
		},
		{
			"key": "bearer_token",
			"value": "",
			"type": "string"
		},
		{
			"key": "project_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "build_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "team_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "group_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "user_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "member_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "webhook_id",
			"value": "1",
			"type": "string"
		}
	],
	"auth": {
		"type": "apikey",
		"apikey": [
			{
				"key": "key",
				"value": "X-API-Key",
				"type": "string"
			},
			{
				"key": "value",
				"value": "{{api_key}}",
				"type": "string"
			},
			{
				"key": "in",
				"value": "header",
				"type": "string"
			}
		]
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Get access token",
					"event": [
						{
							"listen": "test",
							"script": {
								"type": "text/javascript",
								"exec": [
									"var json = pm.response.json();",
									"if (json.token) {",
									"    pm.collectionVariables.set('bearer_token', json.token);",
									"}"
								]
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/auth/token",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "auth", "token"]
						},
						"description": "Exchange your API key for a short-lived Bearer token (valid 1 hour). The token is automatically saved to the `bearer_token` collection variable."
					}
				}
			]
		},
		{
			"name": "Projects",
			"item": [
				{
					"name": "List projects",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/projects?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List all projects in your organization (paginated)."
					}
				},
				{
					"name": "Get a project",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/projects/{{project_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects", "{{project_id}}"]
						},
						"description": "Get details of a specific project."
					}
				},
				{
					"name": "Create a project",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"My New Project\",\n    \"team_id\": {{team_id}},\n    \"folder_name\": \"mobile-apps\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/projects",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects"]
						},
						"description": "Create a new project. Requires `name` and `team_id`. Optional: `folder_name`."
					}
				},
				{
					"name": "Update a project",
					"request": {
						"method": "PUT",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"Updated Project Name\",\n    \"folder_name\": \"new-folder\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/projects/{{project_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects", "{{project_id}}"]
						},
						"description": "Update a project's name and/or folder_name."
					}
				},
				{
					"name": "Delete a project",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/projects/{{project_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects", "{{project_id}}"]
						},
						"description": "Delete a project and all its builds. Admin only."
					}
				},
				{
					"name": "List testers assigned to a project",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/projects/{{project_id}}/testers?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects", "{{project_id}}", "testers"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List testers assigned to an app — direct project_tester rows + members of linked groups, deduped (paginated)."
					}
				}
			]
		},
		{
			"name": "Builds",
			"item": [
				{
					"name": "List builds for a project",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/projects/{{project_id}}/builds?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "projects", "{{project_id}}", "builds"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List builds for a project, newest first (paginated)."
					}
				},
				{
					"name": "Get a build",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/builds/{{build_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "{{build_id}}"]
						},
						"description": "Get details of a specific build."
					}
				},
				{
					"name": "Upload a build",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{ "key": "file", "type": "file", "src": "", "description": "The build file (APK, AAB, or IPA)" },
								{ "key": "project_id", "value": "{{project_id}}", "type": "text", "description": "Target project ID" },
								{ "key": "version", "value": "", "type": "text", "description": "Version string (auto-detected if omitted)", "disabled": true },
								{ "key": "version_code", "value": "", "type": "text", "description": "Version code (auto-detected if omitted)", "disabled": true },
								{ "key": "release_notes", "value": "", "type": "text", "description": "Release notes for this build", "disabled": true }
							]
						},
						"url": {
							"raw": "{{base_url}}/api/v3/builds/upload",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "upload"]
						},
						"description": "Upload an APK, AAB, or IPA file. Package name, version, and platform are auto-detected."
					}
				},
				{
					"name": "Update a build",
					"request": {
						"method": "PUT",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"release_notes\": \"Bug fixes and improvements\",\n    \"tags\": [\"release\", \"v2.0\"]\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/builds/{{build_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "{{build_id}}"]
						},
						"description": "Update a build's release notes and tags."
					}
				},
				{
					"name": "Get build download URL",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/builds/{{build_id}}/download",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "{{build_id}}", "download"]
						},
						"description": "Get a pre-signed download URL for the build file."
					}
				},
				{
					"name": "Delete a build",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/builds/{{build_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "{{build_id}}"]
						},
						"description": "Soft-delete a build. Admin only."
					}
				},
				{
					"name": "Copy a build",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"app_name\": \"My App (Copy)\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/builds/{{build_id}}/copy",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "{{build_id}}", "copy"]
						},
						"description": "Duplicate a build within the same app. The new row references the same file in storage. Replaces legacy POST /api/1/projects/{pid}/builds/{bid}/copy."
					}
				},
				{
					"name": "Notify testers about a build",
					"request": {
						"method": "POST",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/builds/{{build_id}}/notify-testers",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "builds", "{{build_id}}", "notify-testers"]
						},
						"description": "Email the new-build notification to every tester assigned to the app. Replaces legacy POST /api/1/projects/{pid}/builds/{bid}/invites."
					}
				}
			]
		},
		{
			"name": "Teams",
			"item": [
				{
					"name": "List teams",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/teams?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "teams"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List all teams in your organization (paginated)."
					}
				},
				{
					"name": "Get a team",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/teams/{{team_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "teams", "{{team_id}}"]
						},
						"description": "Get details of a specific team."
					}
				},
				{
					"name": "Create a team",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"Engineering\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/teams",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "teams"]
						},
						"description": "Create a new team. Admin only."
					}
				},
				{
					"name": "Update a team",
					"request": {
						"method": "PUT",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"Updated Team Name\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/teams/{{team_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "teams", "{{team_id}}"]
						},
						"description": "Update a team's name. Admin only."
					}
				},
				{
					"name": "Delete a team",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/teams/{{team_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "teams", "{{team_id}}"]
						},
						"description": "Delete a team and all its projects. Admin only."
					}
				}
			]
		},
		{
			"name": "Testers",
			"item": [
				{
					"name": "List testers",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/testers?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "testers"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" },
								{ "key": "role", "value": "", "disabled": true, "description": "Filter: account_owner, super_admin, member, tester" },
								{ "key": "search", "value": "", "disabled": true, "description": "Search by email or name" },
								{ "key": "sort", "value": "joined", "disabled": true, "description": "Sort: user, role, joined" },
								{ "key": "dir", "value": "desc", "disabled": true, "description": "Direction: asc, desc" }
							]
						},
						"description": "List all testers in your organization (paginated, searchable)."
					}
				},
				{
					"name": "Get a tester",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/testers/{{tester_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "testers", "{{tester_id}}"]
						},
						"description": "Get details of a specific tester."
					}
				},
				{
					"name": "Invite a tester",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"email\": \"newtester@example.com\",\n    \"notify\": true,\n    \"groups\": []\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/testers",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "testers"]
						},
						"description": "Invite a tester by email. Creates the user if needed. Optionally sends an invitation email (notify=true by default) and adds the tester to the given groups. Only the Tester role can be created via the API. Admin only."
					}
				},
				{
					"name": "Remove a tester",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/testers/{{tester_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "testers", "{{tester_id}}"]
						},
						"description": "Remove a tester from the organization. Admin only."
					}
				},
				{
					"name": "Block a tester",
					"request": {
						"method": "POST",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/testers/{{tester_id}}/block",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "testers", "{{tester_id}}", "block"]
						},
						"description": "Block a tester. Admin only."
					}
				},
				{
					"name": "Unblock a tester",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/testers/{{tester_id}}/block",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "testers", "{{tester_id}}", "block"]
						},
						"description": "Unblock a tester. Admin only."
					}
				}
			]
		},
		{
			"name": "Groups",
			"item": [
				{
					"name": "List groups",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/groups?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List all groups in your organization (paginated)."
					}
				},
				{
					"name": "Get a group",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}"]
						},
						"description": "Get group details including testers and projects."
					}
				},
				{
					"name": "Create a group",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"QA Testers\",\n    \"team_id\": {{team_id}}\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/groups",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups"]
						},
						"description": "Create a new group. Admin only."
					}
				},
				{
					"name": "Update a group",
					"request": {
						"method": "PUT",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"Updated Group Name\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}"]
						},
						"description": "Update a group's name. Admin only."
					}
				},
				{
					"name": "Delete a group",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}"]
						},
						"description": "Delete a group. Admin only."
					}
				},
				{
					"name": "Add tester to group",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"email\": \"tester@example.com\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}/testers",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}", "testers"]
						},
						"description": "Add a tester to a group by email. Creates the user if needed. Admin only."
					}
				},
				{
					"name": "Remove tester from group",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}/testers/{{user_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}", "testers", "{{user_id}}"]
						},
						"description": "Remove a tester from a group by user ID. Admin only."
					}
				},
				{
					"name": "List testers in a group",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}/testers?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}", "testers"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List the users that are members of this group (paginated)."
					}
				},
				{
					"name": "List projects in a group",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/groups/{{group_id}}/projects?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "groups", "{{group_id}}", "projects"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List the apps this group has access to (paginated)."
					}
				}
			]
		},
		{
			"name": "Webhooks",
			"item": [
				{
					"name": "List webhooks",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/webhooks?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "webhooks"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" }
							]
						},
						"description": "List all webhooks in your organization (paginated)."
					}
				},
				{
					"name": "Get a webhook",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/webhooks/{{webhook_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "webhooks", "{{webhook_id}}"]
						},
						"description": "Get details of a specific webhook."
					}
				},
				{
					"name": "Create a webhook",
					"request": {
						"method": "POST",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"CI Notifications\",\n    \"url\": \"https://example.com/webhook\",\n    \"actions\": [\"build.uploaded\"],\n    \"project_ids\": []\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/webhooks",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "webhooks"]
						},
						"description": "Create a new webhook. Empty project_ids means all projects. Admin only."
					}
				},
				{
					"name": "Update a webhook",
					"request": {
						"method": "PUT",
						"header": [
							{ "key": "Content-Type", "value": "application/json" }
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"Updated Name\",\n    \"status\": \"active\",\n    \"actions\": [\"build.uploaded\", \"build.deleted\"]\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v3/webhooks/{{webhook_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "webhooks", "{{webhook_id}}"]
						},
						"description": "Update a webhook. Status: active or suspended. Admin only."
					}
				},
				{
					"name": "Delete a webhook",
					"request": {
						"method": "DELETE",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/webhooks/{{webhook_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "webhooks", "{{webhook_id}}"]
						},
						"description": "Delete a webhook. Admin only."
					}
				}
			]
		},
		{
			"name": "Audit Logs",
			"item": [
				{
					"name": "List audit logs",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/audits?page=1&per_page=25",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "audits"],
							"query": [
								{ "key": "page", "value": "1" },
								{ "key": "per_page", "value": "25" },
								{ "key": "action", "value": "", "disabled": true, "description": "Filter by action type" },
								{ "key": "search", "value": "", "disabled": true, "description": "Search in email and data" },
								{ "key": "from", "value": "", "disabled": true, "description": "Start date (ISO 8601)" },
								{ "key": "to", "value": "", "disabled": true, "description": "End date (ISO 8601)" }
							]
						},
						"description": "List audit log entries (paginated). Supports filtering by action type, search, and date range. Admin only."
					}
				},
				{
					"name": "List audit action types",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/v3/audits/actions",
							"host": ["{{base_url}}"],
							"path": ["api", "v3", "audits", "actions"]
						},
						"description": "List all distinct action types in the audit log. Admin only."
					}
				}
			]
		},
		{
			"name": "Legacy v1",
			"item": [
				{
					"name": "Upload a build (legacy)",
					"request": {
						"auth": { "type": "noauth" },
						"method": "POST",
						"header": [],
						"body": {
							"mode": "formdata",
							"formdata": [
								{ "key": "api_key", "value": "{{api_key}}", "type": "text", "description": "Your API key" },
								{ "key": "file", "type": "file", "src": "", "description": "The build file (APK, AAB, or IPA)" },
								{ "key": "changelog", "value": "", "type": "text", "description": "Release notes", "disabled": true },
								{ "key": "notify", "value": "on", "type": "text", "description": "Set to 'on' to email testers", "disabled": true },
								{ "key": "groups", "value": "", "type": "text", "description": "Comma-separated tester group names or IDs that get permission to download this app. `none` removes every grant", "disabled": true },
								{ "key": "app_version", "value": "", "type": "text", "description": "Override version string", "disabled": true },
								{ "key": "folder_name", "value": "", "type": "text", "description": "Project folder name", "disabled": true }
							]
						},
						"url": {
							"raw": "{{base_url}}/api/upload",
							"host": ["{{base_url}}"],
							"path": ["api", "upload"]
						},
						"description": "Legacy TestFairy-compatible upload endpoint. Authenticates via `api_key` POST parameter. Project is auto-detected by package name."
					}
				}
			]
		}
	]
}
