# Create Address — Samsara

> Adds a new address to the organization. The user must provide the necessary props such as formatted address, geofence, and name. See the documentation

- Key: `samsara-create-address`
- Type: Action (Write)
- Version: 0.0.2
- App: Samsara (`samsara`) — https://pipedream.com/apps/samsara.md
- This page (HTML): https://pipedream.com/apps/samsara/actions/create-address
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/samsara/actions/create-address/create-address.mjs

## Description

Adds a new address to the organization. The user must provide the necessary props such as formatted address, geofence, and name. [See the documentation](https://developers.samsara.com/reference/createaddress)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `addressTypes` | `string[]` | No | Reporting location type associated with the address (used for ELD reporting purposes). |
| `contactIds` | `string[]` | No | An array of Contact IDs associated with this Address. Options are loaded from the connected account. |
| `externalIds` | `object` | No | The external IDs for the given object. |
| `formattedAddress` | `string` | Yes | The full street address for this address/geofence, as it might be recognized by Google Maps. |
| `geofence` | `object` | Yes | The geofence that defines this address and its bounds. This can either be a circle or a polygon, but not both. See the documentation |
| `latitude` | `string` | No | Latitude of the address. Will be geocoded from Formatted Address if not provided. |
| `longitude` | `string` | No | Longitude of the address. Will be geocoded from Formatted Address if not provided. |
| `name` | `string` | Yes | Name of the address. |
| `notes` | `string` | Yes | Notes about the address. |
| `tagIds` | `string[]` | No | An array of IDs of tags to associate with this address. Options are loaded from the connected account. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "samsara",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "samsara-create-address",
  arguments: {
    addressTypes: ["Address Types"],
    contactIds: ["Contact Ids"],
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "samsara-create-address",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    samsara: { authProvisionId: "apn_xxxxxxx" },
    addressTypes: ["Address Types"],
    contactIds: ["Contact Ids"],
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "samsara-create-address",
    "configured_props": {
      "samsara": { "authProvisionId": "apn_xxxxxxx" },
      "addressTypes": ["Address Types"],
      "contactIds": ["Contact Ids"]
    }
  }'
```

---

- App: https://pipedream.com/apps/samsara.md · All apps: https://pipedream.com/apps
