# Smhi — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Get accurate weather forecasts, current conditions, and severe weather warnings for any location across Sweden. Search for specific Swedish locations to retrieve detailed meteorological analysis and real-time weather data.

**Category:** Weather | **Website:** [smhi.se/](https://smhi.se/) | **Docs:** [parse.bot/marketplace/5a302a84-1db6-4d05-8161-cd16ecf3d6bc/smhi-se-api](https://parse.bot/marketplace/5a302a84-1db6-4d05-8161-cd16ecf3d6bc/smhi-se-api)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/smhi/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Get analysis

Get current weather analysis/observations (MESAN model) for a location. Returns observed weather data including hourly measurements for recent hours with temperature, wind speed, humidity, visibility, and precipitation. Data is organized by day with summary statistics.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `geonameid` | string | Yes | The geonameid of the location as returned by search_locations (e.g. '2673730' for Stockholm). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/smhi/get-analysis \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"geonameid":"<string>"}'
```

### Get current weather

Get current weather conditions (next hour) for a location. Returns the temperature in Celsius, weather symbol code (1-27 indicating clear/cloudy/rain/snow/etc), time of day (day or night), reference time, and full location metadata.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `geonameid` | string | Yes | The geonameid of the location as returned by search_locations (e.g. '2673730' for Stockholm). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/smhi/get-current-weather \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"geonameid":"<string>"}'
```

### Get forecast

Get the 10-day hourly weather forecast for a specific location. Returns detailed forecast data including 10-day hourly breakdowns (days with temperature, precipitation, wind, weather symbols), 24-hour summary periods, and 6-hour summary periods. Each day includes summary statistics (min/max temp, accumulated precipitation) and sunrise/sunset times.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `geonameid` | string | Yes | The geonameid of the location as returned by search_locations (e.g. '2673730' for Stockholm). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/smhi/get-forecast \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"geonameid":"<string>"}'
```

### Get warnings

Get all active weather warnings and alerts for Sweden. Returns current warnings with severity levels (Yellow/Orange/Red), affected areas, descriptions in Swedish and English, and geographic polygons. The list may be empty if no warnings are currently active.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/smhi/get-warnings \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Search locations

Search for locations in Sweden by name. Returns a list of matching places with geonameid, coordinates, and administrative metadata. Results include nearby cities for larger metro areas. The geonameid from results is required for all weather data endpoints.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | The city or place name to search for (e.g. 'Stockholm', 'Göteborg'). |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/smhi/search-locations \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.