# Get Astronomy Time Series — IPGeolocation

> Retrieve astronomical data (sunrise, sunset, moonrise, moonset, moon phase, and more) for a date range up to 90 days for a location by IP address, coordinates, or address. See the documentation

- Key: `ipgeolocation-get-astronomy-time-series`
- 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-astronomy-time-series
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/ipgeolocation/actions/get-astronomy-time-series/get-astronomy-time-series.mjs

## Description

Retrieve astronomical data (sunrise, sunset, moonrise, moonset, moon phase, and more) for a date range up to 90 days for a location by IP address, coordinates, or address. [See the documentation](https://ipgeolocation.io/documentation/astronomy-api.html#time-series-lookup)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `dateStart` | `string` | Yes | Start date of the time series in YYYY-MM-DD format. Maximum range is 90 days |
| `dateEnd` | `string` | Yes | End date of the time series in YYYY-MM-DD format. Maximum range is 90 days from Start Date |
| `ip` | `string` | No | IPv4 or IPv6 address to look up astronomy data for. Leave all fields blank to use the caller's IP |
| `lat` | `string` | No | Latitude coordinate (e.g. 40.7128). Must be used together with Longitude. Takes priority over Location and IP |
| `long` | `string` | No | Longitude coordinate (e.g. -74.0060). Must be used together with Latitude. Takes priority over Location and IP |
| `location` | `string` | No | City or physical address string (e.g. New York, USA). Takes priority over IP |
| `timezone` | `string` | No | IANA timezone name to observe dates in (e.g. America/New_York). |
| `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-astronomy-time-series",
  arguments: {
    dateStart: "Start Date",
    dateEnd: "End Date",
  },
})
```

**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-astronomy-time-series",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    ipgeolocation: { authProvisionId: "apn_xxxxxxx" },
    dateStart: "Start Date",
    dateEnd: "End Date",
  },
})

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-astronomy-time-series",
    "configured_props": {
      "ipgeolocation": { "authProvisionId": "apn_xxxxxxx" },
      "dateStart": "Start Date",
      "dateEnd": "End Date"
    }
  }'
```

---

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