> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truststack.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Locations

> Locations are static and physical places traceability activity occurs.

## What is a Location?

A `location` in the TrustStack is any physical and static location where traceability activity of interest occurs. This could be a farm, warehouse, factory, port.

Essentially, anything that would have a unique street address is considered a `location`.

### What is a sub-location?

A `sub-location` is a physical and static location that is contained within a parent `location`. For example a farm `location` could have many paddocks, silos, sheds, and so fourth. A port could have many docks, a factory with different storage areas, and so forth.

## Location Management

Use the TrustStack SDK or API to manage application locations.

```typescript theme={null}
import {TrustStack} from "@truststack/sdk";

const truststack = new TrustStack({
  apiKey: "your-api-key",
});

const location = await truststack.masterData.locations.create(
  {
    name: "ACME Farm",
  },
  {
    organizationId: "org_123",
  }
);

console.log(location);
```

```json theme={null}
{
  "id": "location-id",
  "name": "ACME Farm"
}
```

Once a location has been created, it can be referenced in traceability events.

A `sub-location` can also be created as child of a parent location, and referenced in traceability events.

```typescript theme={null}
const subLocation = await truststack.masterData.locations.create(
  {
    name: "Paddock 1",
    parentLocationId: "location-id",
  },
  {
    organizationId: "org_123",
  }
);
```
