# Setup tools

[All tool areas](/docs/tools.md). Each tool acts within your access.

## Setup

### create_entity

Create a legal entity: a business with its own currency, tax registrations, tax rates, fees, and (later) Stripe account. Each location belongs to one. The currency can't change once set, so confirm it. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `name` — string; required.  minLength: 1; maxLength: 100
- `legalName` — string; required.  minLength: 1; maxLength: 200
- `currency` — string; required. One of USD, CAD, AUD, EUR, GBP Allowed: "USD", "CAD", "AUD", "EUR", "GBP"
- `address` — object; optional. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

#### Output

- `id` — string; required. 
- `name` — string; required. 
- `legalName` — string; required. 
- `currency` — string; required. 
- `address` — object or null; required. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

### create_fee

Add a fee an entity charges on every order, such as a service charge: a rate of the discounted subtotal (ratePpm, 3% is 30000) or a fixed amount per order in minor units. Taxed by its tax class, or untaxed without one. Prices shown to guests include it. `refundable: false` keeps it when staff refund an order (Perfect Bite's service charge). Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `entityId` — string; required. The entity's id, from get_setup
- `name` — string; required.  minLength: 1; maxLength: 100
- `ratePpm` — integer; optional. Parts per million: 13% is 130000 minimum: 0; maximum: 1000000
- `amount` — integer; optional. Minor units (cents) in the location's currency minimum: 0
- `taxClass` — string or null; optional. The tax class that taxes the fee (id or code), or null for an untaxed fee minLength: 1; default: null
- `refundable` — boolean; optional. Whether staff refunds give it back. false keeps it (and its tax) on every refund except Lokl's own, when it couldn't seat a paid order. Orders keep the setting they were placed under default: true
- `active` — boolean; optional.  default: true
- `position` — integer; optional.  minimum: 0; maximum: 9007199254740991; default: 0

#### Output

- `id` — string; required. 
- `entityId` — string; required. 
- `name` — string; required. 
- `ratePpm` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `amount` — integer or null; required. Minor units (cents) in the location's currency
- `taxClassId` — string or null; required. 
- `refundable` — boolean; required. 
- `active` — boolean; required. 
- `position` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991

### create_location

Create a location (a venue). Give its name and address; the rest is filled in and shown in the preview: the entity (the organization's only one; say which when there are several), a slug for booking links made from the name, and the IANA time zone (from the address's province or state, else the organization's other locations). Schedules are expanded and times shown in the time zone, which can't change once the location has schedules. The entity can't change later. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `entityId` — string; optional. The entity's id, from get_setup
- `name` — string; required.  minLength: 1; maxLength: 100
- `slug` — string; optional.  minLength: 2; maxLength: 48; pattern: "^\[a-z0-9\]+(-\[a-z0-9\]+)\*$"
- `timeZone` — string; optional. 
- `address` — object; optional. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

#### Output

- `id` — string; required. 
- `entityId` — string; required. 
- `name` — string; required. 
- `slug` — string; required. 
- `timeZone` — string; required. 
- `address` — object or null; required. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

### create_resource

Create a resource at a location: a space (a room), equipment, or a staff role. Sessions sharing a resource can't overlap, and its buffers (setup and reset minutes) keep it blocked around each session. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `locationId` — string; required. The location's id, from get_setup
- `kind` — string; required.  Allowed: "space", "equipment", "staff\_role"
- `name` — string; required.  minLength: 1; maxLength: 100
- `bufferBeforeMinutes` — integer; optional.  minimum: 0; maximum: 1440; default: 0
- `bufferAfterMinutes` — integer; optional.  minimum: 0; maximum: 1440; default: 0

#### Output

- `id` — string; required. 
- `locationId` — string; required. 
- `kind` — string; required.  Allowed: "space", "equipment", "staff\_role"
- `name` — string; required. 
- `bufferBeforeMinutes` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `bufferAfterMinutes` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991

### create_tax_class

Create a tax class (e.g. alcohol) for the whole organization. Products pick a class, and entities or locations set the rates for it (set_tax_rate). Every organization starts with standard and exempt. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `code` — string; required.  minLength: 2; maxLength: 32; pattern: "^\[a-z0-9\]+(\_\[a-z0-9\]+)\*$"
- `name` — string; required.  minLength: 1; maxLength: 100

#### Output

- `id` — string; required. 
- `code` — string; required. 
- `name` — string; required. 

### get_setup

Get how the business is set up: its legal entities (currency, tax registrations, tax rates, fees such as a service charge), locations (time zone, address, any tax rates of their own), resources at each location (rooms, equipment, staff roles), and tax classes. Start here before creating products or changing setup. Money is in minor units (cents); rates in parts per million (13% is 130000).

Reads · Members of an organization · Needs setup:read

No input.

#### Output

- `entities` — array; required. 
  - `entities[]` — object; optional. 
    - `entities[].id` — string; required. 
    - `entities[].name` — string; required. 
    - `entities[].legalName` — string; required. 
    - `entities[].currency` — string; required. 
    - `entities[].address` — object or null; required. 
      - `entities[].address.line1` — string; required.  minLength: 1
      - `entities[].address.line2` — string; optional.  minLength: 1
      - `entities[].address.city` — string; required.  minLength: 1
      - `entities[].address.region` — string; required. Province or state code, e.g. ON minLength: 1
      - `entities[].address.postalCode` — string; required.  minLength: 1
      - `entities[].address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"
    - `entities[].taxRegistrations` — array; required. 
      - `entities[].taxRegistrations[]` — object; optional. 
        - `entities[].taxRegistrations[].id` — string; required. 
        - `entities[].taxRegistrations[].entityId` — string; required. 
        - `entities[].taxRegistrations[].jurisdiction` — string; required. 
        - `entities[].taxRegistrations[].tax` — string; required. 
        - `entities[].taxRegistrations[].number` — string; required. 
    - `entities[].taxRates` — array; required. 
      - `entities[].taxRates[]` — object; optional. 
        - `entities[].taxRates[].id` — string; required. 
        - `entities[].taxRates[].entityId` — string or null; required. 
        - `entities[].taxRates[].locationId` — string or null; required. 
        - `entities[].taxRates[].taxClassId` — string; required. 
        - `entities[].taxRates[].name` — string; required. 
        - `entities[].taxRates[].ratePpm` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `entities[].fees` — array; required. 
      - `entities[].fees[]` — object; optional. 
        - `entities[].fees[].id` — string; required. 
        - `entities[].fees[].entityId` — string; required. 
        - `entities[].fees[].name` — string; required. 
        - `entities[].fees[].ratePpm` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
        - `entities[].fees[].amount` — integer or null; required. Minor units (cents) in the location's currency
        - `entities[].fees[].taxClassId` — string or null; required. 
        - `entities[].fees[].refundable` — boolean; required. 
        - `entities[].fees[].active` — boolean; required. 
        - `entities[].fees[].position` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `locations` — array; required. 
  - `locations[]` — object; optional. 
    - `locations[].id` — string; required. 
    - `locations[].entityId` — string; required. 
    - `locations[].name` — string; required. 
    - `locations[].slug` — string; required. 
    - `locations[].timeZone` — string; required. 
    - `locations[].address` — object or null; required. 
      - `locations[].address.line1` — string; required.  minLength: 1
      - `locations[].address.line2` — string; optional.  minLength: 1
      - `locations[].address.city` — string; required.  minLength: 1
      - `locations[].address.region` — string; required. Province or state code, e.g. ON minLength: 1
      - `locations[].address.postalCode` — string; required.  minLength: 1
      - `locations[].address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"
    - `locations[].taxRates` — array; required. 
      - `locations[].taxRates[]` — object; optional. 
        - `locations[].taxRates[].id` — string; required. 
        - `locations[].taxRates[].entityId` — string or null; required. 
        - `locations[].taxRates[].locationId` — string or null; required. 
        - `locations[].taxRates[].taxClassId` — string; required. 
        - `locations[].taxRates[].name` — string; required. 
        - `locations[].taxRates[].ratePpm` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `locations[].resources` — array; required. 
      - `locations[].resources[]` — object; optional. 
        - `locations[].resources[].id` — string; required. 
        - `locations[].resources[].locationId` — string; required. 
        - `locations[].resources[].kind` — string; required.  Allowed: "space", "equipment", "staff\_role"
        - `locations[].resources[].name` — string; required. 
        - `locations[].resources[].bufferBeforeMinutes` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
        - `locations[].resources[].bufferAfterMinutes` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `taxClasses` — array; required. 
  - `taxClasses[]` — object; optional. 
    - `taxClasses[].id` — string; required. 
    - `taxClasses[].code` — string; required. 
    - `taxClasses[].name` — string; required. 

### remove_tax_rate

Stop charging one tax rate. Removing a location's last rate for a class makes the entity's rates apply there again. Holds already placed keep the tax they were quoted. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `taxRateId` — string; required. The tax rate's id

#### Output

- `id` — string; required. 
- `removed` — boolean; required.  Value: true

### remove_tax_registration

Remove one of an entity's tax registrations, e.g. after deregistering. It no longer shows on receipts. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `taxRegistrationId` — string; required. The tax registration's id

#### Output

- `id` — string; required. 
- `removed` — boolean; required.  Value: true

### set_product_fee

Replace an entity fee for one product with its own rate or amount, waive it (0, e.g. no service charge on gift certificates), or go back to the entity's fee (null). Rates are parts per million (3% is 30000); amounts are minor units. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `productId` — string; required. The product's id, from list_products
- `feeId` — string; required. The fee's id, from get_setup
- `override` — any value or null; required. The product's own charge: { ratePpm } or { amount }, 0 to waive the fee for this product, or null to go back to the entity's fee

#### Output

- `productId` — string; required. 
- `feeId` — string; required. 
- `ratePpm` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `amount` — integer or null; required. Minor units (cents) in the location's currency
- `usesEntityFee` — boolean; required. 

### set_tax_rate

Set one tax's rate for a tax class, for a whole entity (entityId) or at one location (locationId). A location's rates for a class replace the entity's rates for that class there. A class can carry several taxes (GST and PST in BC): call once per tax name. Updates the rate if that tax is already set. Rates are parts per million: 13% is 130000. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `entityId` — string; optional. The entity's id, from get_setup
- `locationId` — string; optional. The location's id, from get_setup
- `taxClass` — string; required. A tax class id (txc_...) or code (e.g. standard) minLength: 1
- `name` — string; required.  minLength: 1; maxLength: 32
- `ratePpm` — integer; required. Parts per million: 13% is 130000 minimum: 0; maximum: 1000000

#### Output

- `id` — string; required. 
- `entityId` — string or null; required. 
- `locationId` — string or null; required. 
- `taxClassId` — string; required. 
- `name` — string; required. 
- `ratePpm` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991

### set_tax_registration

Record that an entity is registered to collect a tax in a jurisdiction, with its registration number (e.g. HST in CA-ON, 123456789RT0001). Replaces the number if that tax is already registered there. Receipts and invoices show it. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `entityId` — string; required. The entity's id, from get_setup
- `jurisdiction` — string; required.  pattern: "^\[A-Z\]\{2\}(-\[A-Z0-9\]\{1,3\})?$"
- `tax` — string; required.  minLength: 1; maxLength: 32
- `number` — string; required.  minLength: 1; maxLength: 64

#### Output

- `id` — string; required. 
- `entityId` — string; required. 
- `jurisdiction` — string; required. 
- `tax` — string; required. 
- `number` — string; required. 

### update_entity

Rename an entity, or change its legal name or address. Its currency can't change once set. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `entityId` — string; required. The entity's id, from get_setup
- `name` — string; optional.  minLength: 1; maxLength: 100
- `legalName` — string; optional.  minLength: 1; maxLength: 200
- `currency` — string; optional. Only to confirm it: a currency can't change
- `address` — object or null; optional. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

#### Output

- `id` — string; required. 
- `name` — string; required. 
- `legalName` — string; required. 
- `currency` — string; required. 
- `address` — object or null; required. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

### update_fee

Change a fee: its name, its charge (ratePpm or amount; giving one replaces the other), its tax class (null for untaxed), whether staff refunds give it back, whether it's active, or its order on receipts. Holds already placed keep the total they were quoted, and orders the refund terms. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `feeId` — string; required. The fee's id, from get_setup
- `name` — string; optional.  minLength: 1; maxLength: 100
- `ratePpm` — integer; optional. Parts per million: 13% is 130000 minimum: 0; maximum: 1000000
- `amount` — integer; optional. Minor units (cents) in the location's currency minimum: 0
- `taxClass` — string or null; optional. A tax class id (txc_...) or code (e.g. standard) minLength: 1
- `refundable` — boolean; optional. 
- `active` — boolean; optional. 
- `position` — integer; optional.  minimum: 0; maximum: 9007199254740991

#### Output

- `id` — string; required. 
- `entityId` — string; required. 
- `name` — string; required. 
- `ratePpm` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `amount` — integer or null; required. Minor units (cents) in the location's currency
- `taxClassId` — string or null; required. 
- `refundable` — boolean; required. 
- `active` — boolean; required. 
- `position` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991

### update_location

Rename a location, or change its slug, time zone, or address. Changing the time zone doesn't move sessions already generated. Its entity can't change. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `locationId` — string; required. The location's id, from get_setup
- `name` — string; optional.  minLength: 1; maxLength: 100
- `slug` — string; optional.  minLength: 2; maxLength: 48; pattern: "^\[a-z0-9\]+(-\[a-z0-9\]+)\*$"
- `timeZone` — string; optional. 
- `address` — object or null; optional. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

#### Output

- `id` — string; required. 
- `entityId` — string; required. 
- `name` — string; required. 
- `slug` — string; required. 
- `timeZone` — string; required. 
- `address` — object or null; required. 
  - `address.line1` — string; required.  minLength: 1
  - `address.line2` — string; optional.  minLength: 1
  - `address.city` — string; required.  minLength: 1
  - `address.region` — string; required. Province or state code, e.g. ON minLength: 1
  - `address.postalCode` — string; required.  minLength: 1
  - `address.country` — string; required. ISO 3166-1 alpha-2, e.g. CA pattern: "^\[A-Z\]\{2\}$"

### update_resource

Rename a resource or change its kind or buffers (setup and reset minutes). New buffers apply to sessions generated from now on. Returns a preview to confirm.

Changes · Members of an organization · Needs setup:write

#### Input

- `resourceId` — string; required. The resource's id, from get_setup
- `kind` — string; optional.  Allowed: "space", "equipment", "staff\_role"
- `name` — string; optional.  minLength: 1; maxLength: 100
- `bufferBeforeMinutes` — integer; optional.  minimum: 0; maximum: 1440
- `bufferAfterMinutes` — integer; optional.  minimum: 0; maximum: 1440

#### Output

- `id` — string; required. 
- `locationId` — string; required. 
- `kind` — string; required.  Allowed: "space", "equipment", "staff\_role"
- `name` — string; required. 
- `bufferBeforeMinutes` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `bufferAfterMinutes` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
