> For the complete documentation index, see [llms.txt](https://invoice4u.gitbook.io/invoice4u-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://invoice4u.gitbook.io/invoice4u-docs/branches/get-branches.md).

# Get Branches

Returns all branches for the authenticated organization.

## Endpoint

|              |                                            |
| ------------ | ------------------------------------------ |
| **Method**   | `POST`                                     |
| **Path**     | `/GetBranches`                             |
| **Response** | `Branch[]`, or `null` on auth/server error |

## Request schema

| Field   | Type   | Required | Description           |
| ------- | ------ | -------- | --------------------- |
| `token` | string | Yes      | Authentication token. |

## Example request

```http
POST /Services/ApiService.svc/GetBranches HTTP/1.1
Host: apiqa.invoice4u.co.il
Content-Type: application/json

{
  "token": "<token>"
}
```

## Example response

```json
{
  "GetBranchesResult": [
    {
      "ID": 101,
      "Name": "Head Office",
      "Description": "Main branch",
      "Enabled": true,
      "IsDefault": true,
      "IsMain": true,
      "Email": "office@acme.example"
    },
    {
      "ID": 102,
      "Name": "North Branch",
      "Enabled": true,
      "IsDefault": false,
      "IsMain": false
    }
  ]
}
```

## Errors

Returns `null` when the token is invalid or on server error. Use the returned `ID` values as `BranchID` when [creating documents](/invoice4u-docs/documents/create-document.md).

## Try it

## Get branches

> Returns all branches for the authenticated organization. Returns null on auth/server error.

```json
{"openapi":"3.0.3","info":{"title":"Invoice4U API","version":"1.0.0"},"tags":[{"name":"Branches","description":"Organization branches."}],"servers":[{"url":"https://api.invoice4u.co.il/Services/ApiService.svc","description":"Production"},{"url":"https://apiqa.invoice4u.co.il/Services/ApiService.svc","description":"QA (staging)"}],"paths":{"/GetBranches":{"post":{"tags":["Branches"],"operationId":"GetBranches","summary":"Get branches","description":"Returns all branches for the authenticated organization. Returns null on auth/server error.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Branch list.","content":{"application/json":{"schema":{"type":"object","properties":{"GetBranchesResult":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/Branch"}}}}}}}}}}},"components":{"schemas":{"Branch":{"type":"object","properties":{"ID":{"type":"integer"},"Name":{"type":"string"},"Description":{"type":"string","nullable":true},"Enabled":{"type":"boolean"},"IsDefault":{"type":"boolean"},"IsMain":{"type":"boolean"},"Email":{"type":"string","nullable":true}}}}}}
```
