{
  "info": {
    "name": "Invosend Invoice API",
    "description": "Invosend public API. Set the `apiKey` collection variable to a key from https://app.invosend.com/settings/api-keys (paid plan, workspace owner). 'Generate an invoice' saves `invoiceId` (and `seriesId` for recurring) so the other requests work as-is. Full documentation: https://www.invosend.com/developers",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiKey}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://app.invosend.com"
    },
    {
      "key": "apiKey",
      "value": "isk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
    },
    {
      "key": "invoiceId",
      "value": ""
    },
    {
      "key": "seriesId",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Invoices",
      "description": "Create invoices and read or change them.",
      "item": [
        {
          "name": "Generate an invoice",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{$guid}}",
                "description": "1-255 printable characters, for example a UUID per invoice. A retry with the same key and body returns the first response (header `Idempotent-Replayed: true`) without creating another invoice or using another credit. Kept for 24 hours per workspace; only successful responses are stored.",
                "disabled": false
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/generate-external",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "generate-external"
              ],
              "query": []
            },
            "description": "Creates an invoice and its PDF. Uses 1 invoice credit per successful call. The invoice is **not emailed** (except follow-up invoices of a recurring series). Send `is_recurring` with `recurring_interval` to start a recurring series.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"customer_name\": \"Acme Corp\",\n  \"customer_email\": \"billing@acme.com\",\n  \"items\": [\n    {\n      \"description\": \"Consulting Services\",\n      \"quantity\": 2,\n      \"price\": 500,\n      \"tax_rate\": 11\n    }\n  ],\n  \"discount_total\": 50,\n  \"currency\": \"USD\",\n  \"notes\": \"Thank you for your business.\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const body = pm.response.json();",
                  "  if (body.data && body.data.id) pm.collectionVariables.set('invoiceId', body.data.id);",
                  "  if (body.data && body.data.recurring && body.data.recurring.schedule_id) {",
                  "    pm.collectionVariables.set('seriesId', body.data.recurring.schedule_id);",
                  "  }",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "List invoices",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "",
                  "disabled": true
                },
                {
                  "key": "page",
                  "value": "1",
                  "disabled": true
                },
                {
                  "key": "pageSize",
                  "value": "25",
                  "disabled": true
                }
              ]
            },
            "description": "Lists invoices of the workspace, newest first."
          },
          "response": []
        },
        {
          "name": "Get an invoice",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/{{invoiceId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "{{invoiceId}}"
              ],
              "query": []
            },
            "description": "Returns one invoice."
          },
          "response": []
        },
        {
          "name": "Update invoice status",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/{{invoiceId}}/status",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "{{invoiceId}}",
                "status"
              ],
              "query": []
            },
            "description": "Sets the status of an invoice. Never sends an email. Status changes trigger the matching webhook event.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"paid\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Archive or unarchive an invoice",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/{{invoiceId}}/archive",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "{{invoiceId}}",
                "archive"
              ],
              "query": []
            },
            "description": "Archives or restores an invoice.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"is_archived\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Get or regenerate the PDF",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/{{invoiceId}}/pdf",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "{{invoiceId}}",
                "pdf"
              ],
              "query": []
            },
            "description": "Returns the PDF URL, regenerating the file when it is missing or when `force` is true.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"force\": false\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Recurring",
      "description": "Manage recurring series created with `is_recurring` / `recurring_interval`.",
      "item": [
        {
          "name": "List recurring series",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/recurring",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "recurring"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "",
                  "disabled": true
                },
                {
                  "key": "page",
                  "value": "1",
                  "disabled": true
                },
                {
                  "key": "pageSize",
                  "value": "25",
                  "disabled": true
                }
              ]
            },
            "description": "Lists the recurring series of the workspace, newest first."
          },
          "response": []
        },
        {
          "name": "Get a recurring series",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/recurring/{{seriesId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "recurring",
                "{{seriesId}}"
              ],
              "query": []
            },
            "description": "Returns one series with all its occurrences."
          },
          "response": []
        },
        {
          "name": "Pause or resume a series",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/recurring/{{seriesId}}/status",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "recurring",
                "{{seriesId}}",
                "status"
              ],
              "query": []
            },
            "description": "Resuming requires a plan with recurring invoices.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"paused\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Extend a series",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/recurring/{{seriesId}}/extend",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "recurring",
                "{{seriesId}}",
                "extend"
              ],
              "query": []
            },
            "description": "Adds occurrences after the last one. Send `count` or `end_date`, not both.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"count\": 3\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Change how often a series repeats",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/recurring/{{seriesId}}/frequency",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "recurring",
                "{{seriesId}}",
                "frequency"
              ],
              "query": []
            },
            "description": "Replaces the upcoming occurrences that have not been generated yet; generated ones are kept. `start_date` must be in the future. Send `count` or `end_date`, not both.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"frequency\": \"monthly\",\n  \"start_date\": \"2027-01-01\",\n  \"count\": 6\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        },
        {
          "name": "Skip an upcoming occurrence",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/invoices/external/recurring/{{seriesId}}/skip",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "invoices",
                "external",
                "recurring",
                "{{seriesId}}",
                "skip"
              ],
              "query": []
            },
            "description": "Removes one upcoming occurrence. Occurrences that already produced an invoice cannot be removed.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"date\": \"2027-01-01\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": []
        }
      ]
    }
  ]
}
