# Get Timezone — IPGeolocation

> Retrieve timezone information using a timezone name, IP address, coordinates, city, IATA code, ICAO code, or UN/LOCODE. See the documentation

- Key: `ipgeolocation-get-timezone`
- Type: Action (Read-only)
- Version: 0.0.2
- App: IPGeolocation (`ipgeolocation`) — https://pipedream.com/apps/ipgeolocation.md
- This page (HTML): https://pipedream.com/apps/ipgeolocation/actions/get-timezone
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/ipgeolocation/actions/get-timezone/get-timezone.mjs

## Description

Retrieve timezone information using a timezone name, IP address, coordinates, city, IATA code, ICAO code, or UN/LOCODE. [See the documentation](https://ipgeolocation.io/documentation/timezone-api.html)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `tz` | `string` | No | IANA timezone name to look up (e.g. America/New_York). |
| `ip` | `string` | No | IPv4 or IPv6 address to look up timezone for. Leave blank to lookup timezone for the caller's IP address if no other parameters are provided |
| `lat` | `string` | No | Latitude coordinate (e.g. 40.7128). |
| `long` | `string` | No | Longitude coordinate (e.g. -74.0060). |
| `location` | `string` | No | City or physical address string (e.g. New York, USA) |
| `iata` | `string` | No | Airport IATA code (e.g. JFK) |
| `icao` | `string` | No | Airport ICAO code (e.g. KJFK) |
| `locode` | `string` | No | UN/LOCODE for a port or city (e.g. USNYC) |
| `lang` | `string` | No | Language for the response. Defaults to English. Only available on paid plans |

## 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": "ipgeolocation",
      },
    },
  },
)

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: "ipgeolocation-get-timezone",
  arguments: {
    tz: "Timezone Name",
    ip: "IP Address",
  },
})
```

**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: "ipgeolocation-get-timezone",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    ipgeolocation: { authProvisionId: "apn_xxxxxxx" },
    tz: "Timezone Name",
    ip: "IP Address",
  },
})

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": "ipgeolocation-get-timezone",
    "configured_props": {
      "ipgeolocation": { "authProvisionId": "apn_xxxxxxx" },
      "tz": "Timezone Name",
      "ip": "IP Address"
    }
  }'
```

---

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