---
displayed_sidebar: servicesSidebar
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# Address

An address is used across the Medusa backend within other schemas and object types. For example, a customer's billing and shipping addresses both use the Address entity.

## Constructors

### constructor

`**new Address**()`

An address is used across the Medusa backend within other schemas and object types. For example, a customer's billing and shipping addresses both use the Address entity.

## Properties

<ParameterTypes parameters={[
  {
    "name": "address_1",
    "type": "``null`` \\| `string`",
    "description": "Address line 1",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "address_2",
    "type": "``null`` \\| `string`",
    "description": "Address line 2",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "city",
    "type": "``null`` \\| `string`",
    "description": "City",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "company",
    "type": "``null`` \\| `string`",
    "description": "Company name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "country",
    "type": "``null`` \\| [Country](Country.mdx)",
    "description": "A country object.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "country_code",
    "type": "``null`` \\| `string`",
    "description": "The 2 character ISO code of the country in lower case",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "created_at",
    "type": "`Date`",
    "description": "The date with timezone at which the resource was created.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customer",
    "type": "``null`` \\| [Customer](Customer.mdx)",
    "description": "Available if the relation `customer` is expanded.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customer_id",
    "type": "``null`` \\| `string`",
    "description": "ID of the customer this address belongs to",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "deleted_at",
    "type": "``null`` \\| `Date`",
    "description": "The date with timezone at which the resource was deleted.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "first_name",
    "type": "``null`` \\| `string`",
    "description": "First name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "id",
    "type": "`string`",
    "description": "ID of the address",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "last_name",
    "type": "``null`` \\| `string`",
    "description": "Last name",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "metadata",
    "type": "`Record<string, unknown>`",
    "description": "An optional key-value map with additional details",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "phone",
    "type": "``null`` \\| `string`",
    "description": "Phone Number",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "postal_code",
    "type": "``null`` \\| `string`",
    "description": "Postal Code",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "province",
    "type": "``null`` \\| `string`",
    "description": "Province",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "updated_at",
    "type": "`Date`",
    "description": "The date with timezone at which the resource was updated.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Methods

### beforeInsert

`Private **beforeInsert**(): void`

#### Returns

`void`

<ParameterTypes parameters={[
  {
    "name": "void",
    "type": "`void`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />
