# Branches

> Invoice from places other than the issuer's tax address: each branch with its postal code, its address on the PDF, its series and, if you want, its own brand.

An issuer invoices from its tax address (the **Matriz**, head office) and, if it has more locations, from its branches. The CFDI only carries the location's postal code (`LugarExpedicion`), and the time of the `Fecha` depends on it (Cancún, Tijuana and Hermosillo don't share Mexico City's time), as does the 8 % IVA of the border region (in force until December 31, 2026: an income invoice dated 2027, or a global for a 2027 period, is refused at 8 % unless an extension is published; credit notes aren't). Its address goes on the PDF and, if you give them, its invoices carry their own series. They're the same as **Ajustes › Sucursales** in the app.

## Create a branch

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/branches \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sucursal Monterrey",
    "zip": "64000",
    "address": { "street": "Av. Constitución", "exterior": "1500", "neighborhood": "Centro", "city": "Monterrey" },
    "phone": "81 1234 5678",
    "series": { "invoice": "MTY" }
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const branch = await fiscalisto.branches.create({
  name: "Sucursal Monterrey",
  zip: "64000",
  address: {
    street: "Av. Constitución",
    exterior: "1500",
    neighborhood: "Centro",
    city: "Monterrey",
  },
  phone: "81 1234 5678",
  series: { invoice: "MTY" },
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

branch = fiscalisto.branches.create({
    "name": "Sucursal Monterrey",
    "zip": "64000",
    "address": {
        "street": "Av. Constitución",
        "exterior": "1500",
        "neighborhood": "Centro",
        "city": "Monterrey",
    },
    "phone": "81 1234 5678",
    "series": {"invoice": "MTY"},
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$branch = $fiscalisto->branches->create([
    'name' => 'Sucursal Monterrey',
    'zip' => '64000',
    'address' => [
        'street' => 'Av. Constitución',
        'exterior' => '1500',
        'neighborhood' => 'Centro',
        'city' => 'Monterrey',
    ],
    'phone' => '81 1234 5678',
    'series' => ['invoice' => 'MTY'],
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	branch, err := client.Branches.Create(ctx, &fiscalisto.CreateBranchParams{
		Name: "Sucursal Monterrey",
		Zip:  "64000",
		Address: &fiscalisto.CreateBranchParamsAddress{
			Street:       fiscalisto.String("Av. Constitución"),
			Exterior:     fiscalisto.String("1500"),
			Neighborhood: fiscalisto.String("Centro"),
			City:         fiscalisto.String("Monterrey"),
		},
		Phone: fiscalisto.String("81 1234 5678"),
		Series: &fiscalisto.CreateBranchParamsSeries{
			Invoice: fiscalisto.String("MTY"),
		},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(branch.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.CreateBranchParams;
import com.fiscalisto.model.CreateBranchParamsAddress;
import com.fiscalisto.model.CreateBranchParamsSeries;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var branch = fiscalisto.branches().create(new CreateBranchParams()
        .setName("Sucursal Monterrey")
        .setZip("64000")
        .setAddress(new CreateBranchParamsAddress()
                .setStreet("Av. Constitución")
                .setExterior("1500")
                .setNeighborhood("Centro")
                .setCity("Monterrey"))
        .setPhone("81 1234 5678")
        .setSeries(new CreateBranchParamsSeries().setInvoice("MTY")));
System.out.println(branch.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var branch = await fiscalisto.Branches.CreateAsync(new CreateBranchParams
{
    Name = "Sucursal Monterrey",
    Zip = "64000",
    Address = new()
    {
        Street = "Av. Constitución",
        Exterior = "1500",
        Neighborhood = "Centro",
        City = "Monterrey",
    },
    Phone = "81 1234 5678",
    Series = new() { Invoice = "MTY" },
});
```

Returns the branch (`brn_…`), with `state` taken from its postal code if you don't send it. Several branches can share a postal code (two stores in the same mall), including the issuer's tax address one: each invoice issued from one with `branch` remembers which one it came from, for its PDF, its payments and its credit notes. Up to 200 per issuer.

`series` has one series per CFDI type: `invoice` (invoices, type I), `credit_note` (credit notes, type E), `payment` (payment complements, type P) and `transfer` (transfers, type T). The ones you don't give use the issuer's.

## Invoice from it

Send `branch` on the invoice:

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: pedido-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "branch": "brn_OufpKqnrvx9p3",
    "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" },
    "payment_form": "03",
    "items": [{ "description": "Consultoría", "product_key": "80101500", "unit_price": 1000 }]
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  branch: "brn_OufpKqnrvx9p3",
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
  },
  payment_form: "03",
  items: [
    {
      description: "Consultoría",
      product_key: "80101500",
      unit_price: 1000,
    },
  ],
}, { idempotencyKey: "pedido-1042" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "branch": "brn_OufpKqnrvx9p3",
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
    },
    "payment_form": "03",
    "items": [
        {
            "description": "Consultoría",
            "product_key": "80101500",
            "unit_price": 1000,
        },
    ],
}, idempotency_key="pedido-1042")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'branch' => 'brn_OufpKqnrvx9p3',
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
    ],
    'payment_form' => '03',
    'items' => [
        [
            'description' => 'Consultoría',
            'product_key' => '80101500',
            'unit_price' => 1000,
        ],
    ],
], ['idempotency_key' => 'pedido-1042']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Branch: fiscalisto.String("brn_OufpKqnrvx9p3"),
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "ICV060329BY0",
			LegalName: "INMOBILIARIA CVA",
			TaxSystem: "601",
			Zip:       "33826",
		}),
		PaymentForm: fiscalisto.String("03"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description: fiscalisto.String("Consultoría"),
				ProductKey:  fiscalisto.String("80101500"),
				UnitPrice:   fiscalisto.Float64(1000),
			},
		},
	}, fiscalisto.WithIdempotencyKey("pedido-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setBranch("brn_OufpKqnrvx9p3")
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("ICV060329BY0")
                .setLegalName("INMOBILIARIA CVA")
                .setTaxSystem("601")
                .setZip("33826"))
        .setPaymentForm("03")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Consultoría")
                        .setProductKey("80101500")
                        .setUnitPrice(1000)
        )), RequestOptions.idempotencyKey("pedido-1042"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Branch = "brn_OufpKqnrvx9p3",
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "ICV060329BY0",
        LegalName = "INMOBILIARIA CVA",
        TaxSystem = "601",
        Zip = "33826",
    },
    PaymentForm = "03",
    Items = new()
    {
        new()
        {
            Description = "Consultoría",
            ProductKey = "80101500",
            UnitPrice = 1000,
        },
    },
}, new RequestOptions { IdempotencyKey = "pedido-1042" });
```

The invoice goes out with `LugarExpedicion="64000"`, the `MTY` series and the branch's address on the PDF, and its object says `branch: "brn_OufpKqnrvx9p3"`. Without `branch`, it comes from the Matriz (`branch: null`). Its payment complements and credit notes follow the invoice's branch on their own: there's no need to send it again. `branch` also goes on each invoice of a batch and on recurring invoices.

The `Fecha` is the branch's time: an invoice from your Cancún branch at 11:30 pm on the 31st in Mexico City is already 12:30 am on the 1st.

## Its own brand

If a branch presents itself under another brand (another hotel, another store), it can have its own trade name (`trade_name`), color (`pdf_color`) and PDF style (`pdf_style`: `clasico`, `moderno`, `compacto` or `minimalista`). Whatever it doesn't have, or you send as `null`, comes from the issuer. What's invoiced from it goes out with its brand: its PDF, and the name on the email and on the invoice's page. Its logo is uploaded in **Ajustes › Sucursales** in the app or with `POST /v1/branches/{id}/logo` (`file`: PNG or JPG up to 1 MB, base64; `DELETE` removes it and falls back to the issuer's), and the object carries it in `logo_url`. It goes on the PDF and on the self-invoicing portal of the branch's tickets: a ticket recorded with `branch` shows the buyer the branch's trade name and logo, and its invoice goes out with the branch's zip (see [Self-invoicing](https://fiscalisto.com/en/docs/api/autofactura)).

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/branches/brn_OufpKqnrvx9p3 \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "trade_name": "Ferretería del Norte", "pdf_color": "#0F766E", "pdf_style": "moderno" }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const branch = await fiscalisto.branches.update("brn_OufpKqnrvx9p3", {
  trade_name: "Ferretería del Norte",
  pdf_color: "#0F766E",
  pdf_style: "moderno",
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

branch = fiscalisto.branches.update("brn_OufpKqnrvx9p3", {
    "trade_name": "Ferretería del Norte",
    "pdf_color": "#0F766E",
    "pdf_style": "moderno",
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$branch = $fiscalisto->branches->update('brn_OufpKqnrvx9p3', [
    'trade_name' => 'Ferretería del Norte',
    'pdf_color' => '#0F766E',
    'pdf_style' => 'moderno',
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	branch, err := client.Branches.Update(ctx, "brn_OufpKqnrvx9p3", &fiscalisto.UpdateBranchParams{
		TradeName: fiscalisto.String("Ferretería del Norte"),
		PDFColor:  fiscalisto.String("#0F766E"),
		PDFStyle:  fiscalisto.String("moderno"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(branch.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.UpdateBranchParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var branch = fiscalisto.branches().update("brn_OufpKqnrvx9p3", new UpdateBranchParams()
        .setTradeName("Ferretería del Norte")
        .setPdfColor("#0F766E")
        .setPdfStyle("moderno"));
System.out.println(branch.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var branch = await fiscalisto.Branches.UpdateAsync("brn_OufpKqnrvx9p3", new UpdateBranchParams
{
    TradeName = "Ferretería del Norte",
    PdfColor = "#0F766E",
    PdfStyle = "moderno",
});
```

## Its time zone

Each branch has `time_zone`, the zone its day starts in (`America/Mexico_City`, `America/Mazatlan`, `America/Hermosillo`, `America/Tijuana`, `America/Cancun`, `America/Matamoros` for the northeastern border municipalities and `America/Ciudad_Juarez` for Ciudad Juárez, which change their clocks in summer; articles 3 and 5 of the Ley de los Husos Horarios), and `time_zone_chosen`: `false` when it comes from its postal code and `true` when it was chosen. To choose it, send `time_zone` when you create or change it; `null` goes back to its postal code's. The zone decides what «today» is for the branch in notices and daily limits. The CFDI's `Fecha` always follows its postal code's time (Anexo 20), whatever zone you choose.

## Change, archive or delete it

`POST /v1/branches/{id}` changes only what you send; a series set to `null` goes back to the issuer's. A branch that has already invoiced doesn't change its postal code (its invoices are recognized by it): if it moved, archive it and create another.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/branches/brn_OufpKqnrvx9p3 \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "archived": true }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const branch = await fiscalisto.branches.update("brn_OufpKqnrvx9p3", { archived: true });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

branch = fiscalisto.branches.update("brn_OufpKqnrvx9p3", {"archived": True})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$branch = $fiscalisto->branches->update('brn_OufpKqnrvx9p3', ['archived' => true]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	branch, err := client.Branches.Update(ctx, "brn_OufpKqnrvx9p3", &fiscalisto.UpdateBranchParams{
		Archived: fiscalisto.Bool(true),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(branch.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.UpdateBranchParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var branch = fiscalisto.branches().update("brn_OufpKqnrvx9p3", new UpdateBranchParams().setArchived(true));
System.out.println(branch.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var branch = await fiscalisto.Branches.UpdateAsync("brn_OufpKqnrvx9p3", new UpdateBranchParams { Archived = true });
```

Once archived, it can no longer invoice (an invoice with its `branch` is refused) and its invoices keep naming it; `"archived": false` restores it. `DELETE /v1/branches/{id}` only deletes one that never invoiced; with invoices it returns `branch_has_invoices`.

`GET /v1/branches` lists them, newest first, without the archived ones unless you pass `include_archived=true`; `zip=64000` keeps the one with that postal code.

## In the app and with agents

What you do through the API shows in **Ajustes › Sucursales**. With the [MCP](https://fiscalisto.com/en/docs/api/agentes), `sucursales` lists them with their brand, `guardar_sucursal` adds or changes one (including the Matriz's name), `eliminar_sucursal` deletes one without invoices after confirming, `buscar_facturas` filters with `sucursal` and `crear_borrador` invoices from one with `sucursal`.
