{
  "info": {
    "name": "ZapBounce API",
    "description": "Requests for the deployed ZapBounce API (https://app.zapbounce.com/api/v1). Set the `apiKey` collection variable to a key from the dashboard (API keys). Reference: https://zapbounce.com/docs",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "X-API-Key",
        "type": "string"
      },
      {
        "key": "value",
        "value": "{{apiKey}}",
        "type": "string"
      },
      {
        "key": "in",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://app.zapbounce.com/api/v1"
    },
    {
      "key": "apiKey",
      "value": "zb_live_REPLACE_ME"
    },
    {
      "key": "jobId",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Verify",
      "item": [
        {
          "name": "Verify emails (sync, 1-20)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "verify"
              ]
            },
            "description": "Scope: verification.run. One to twenty addresses. `persist: false` returns results without storing them.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"emails\": [\n    \"ada@example.com\",\n    \"ops@example.org\"\n  ],\n  \"persist\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('2xx and a results array', () => {",
                  "  pm.expect([200, 201]).to.include(pm.response.code);",
                  "  pm.expect(pm.response.json().results).to.be.an('array');",
                  "});"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Jobs",
      "item": [
        {
          "name": "Create job",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "type": "text",
                "description": "8-128 characters. Replays the first response for 24 hours."
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Scope: jobs.manage. Up to 50,000 addresses. Saves the job id into the `jobId` collection variable.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"emails\": [\n    \"ada@example.com\",\n    \"grace@example.org\"\n  ],\n  \"source\": \"api\",\n  \"forceFresh\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const job = pm.response.json();",
                  "pm.test('job created', () => pm.expect(job.id).to.be.a('string'));",
                  "pm.collectionVariables.set('jobId', job.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "List jobs",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs?page=1&pageSize=20",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "disabled": false
                },
                {
                  "key": "pageSize",
                  "value": "20",
                  "disabled": false
                },
                {
                  "key": "archived",
                  "value": "true",
                  "disabled": true
                },
                {
                  "key": "q",
                  "value": "",
                  "disabled": true
                }
              ]
            },
            "description": "Scope: jobs.view. Paginated: `page` from 1, `pageSize` 1-100 (default 20). `archived=true` lists archived jobs; `q` searches id, status, source or an address."
          }
        },
        {
          "name": "Get job (status and totals)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs/{{jobId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs",
                "{{jobId}}"
              ]
            },
            "description": "Scope: jobs.view. Poll until `status` is completed, partial, failed or cancelled."
          }
        },
        {
          "name": "List job emails (per-address results)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs/{{jobId}}/emails?page=1&pageSize=100",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs",
                "{{jobId}}",
                "emails"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "disabled": false
                },
                {
                  "key": "pageSize",
                  "value": "100",
                  "disabled": false
                },
                {
                  "key": "status",
                  "value": "unknown",
                  "disabled": true
                },
                {
                  "key": "q",
                  "value": "",
                  "disabled": true
                }
              ]
            },
            "description": "Scope: jobs.view. `status` is one of pending, needs_retry, valid, invalid, catch_all, unknown."
          }
        },
        {
          "name": "Export job results (CSV)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs/{{jobId}}/export",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs",
                "{{jobId}}",
                "export"
              ]
            },
            "description": "Scope: jobs.view. Columns: email, status, reason_code, mx, smtp_code, checked_at. Use Send and Download to save the file."
          }
        },
        {
          "name": "Cancel job",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs/{{jobId}}/cancel",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs",
                "{{jobId}}",
                "cancel"
              ]
            },
            "description": "Scope: jobs.manage. Returns JOB_NOT_CANCELLABLE if the job already finished."
          }
        },
        {
          "name": "Archive job",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs/{{jobId}}/archive",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs",
                "{{jobId}}",
                "archive"
              ]
            },
            "description": "Scope: jobs.manage. Hides the job from the default list."
          }
        },
        {
          "name": "Delete job",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/jobs/{{jobId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "jobs",
                "{{jobId}}"
              ]
            },
            "description": "Scope: jobs.manage. Deletes the job and its rows. Returns 204 with no body."
          }
        }
      ]
    },
    {
      "name": "Credits",
      "item": [
        {
          "name": "Get credit balance",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/credits/balance",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "credits",
                "balance"
              ]
            },
            "description": "Scope: credits.view. Returns { \"balance\": n }."
          }
        },
        {
          "name": "List credit ledger",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/credits/ledger?page=1&pageSize=20",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "credits",
                "ledger"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "disabled": false
                },
                {
                  "key": "pageSize",
                  "value": "20",
                  "disabled": false
                },
                {
                  "key": "q",
                  "value": "",
                  "disabled": true
                }
              ]
            },
            "description": "Scope: credits.view. Paginated entries plus the current balance."
          }
        }
      ]
    }
  ]
}