Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Access custom configured data products for your subscription.

Endpoints

MethodEndpointDescription
GET/custom/fileList custom product files
GET/custom/file/{file_id}Download a custom product file

Overview

Custom products are tailored data deliveries configured specifically for your organization’s needs. These may include:

Contact your Spire Weather representative to configure custom products.


List Custom Files

GET /custom/file

Retrieve a list of available custom product files.

Example Request

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/custom/file' \
  -H 'spire-api-key: YOUR_API_KEY'

Response

{
  "meta": {
    "count": 6
  },
  "files": [
    "sof.20240115.t00z.0p25.custom-product.f000.grib2",
    "sof.20240115.t00z.0p25.custom-product.f006.grib2",
    "sof.20240115.t00z.0p25.custom-product.f012.grib2"
  ]
}

Download Custom File

GET /custom/file/{file_id}

Download a specific custom product file.

Path Parameters

ParameterTypeRequiredDescription
file_idstringYesFilename to download

Example Request

Shell
Python
Node.js
curl -OJL -X GET \
  'https://api.wx.spire.com/custom/file/sof.20240115.t00z.0p25.custom-product.f000.grib2' \
  -H 'spire-api-key: YOUR_API_KEY'

Python Example

Download all custom product files:

import requests
import os

headers = {'spire-api-key': 'YOUR_API_KEY'}
base_url = 'https://api.wx.spire.com/custom/file'

# Get list of available files
response = requests.get(base_url, headers=headers)
files = response.json()['files']

print(f"Found {len(files)} custom files")

# Create output directory
os.makedirs('custom_data', exist_ok=True)

# Download each file
for filename in files:
    print(f'Downloading: {filename}')

    file_response = requests.get(
        f'{base_url}/{filename}',
        headers=headers,
        allow_redirects=True
    )

    filepath = os.path.join('custom_data', filename)
    with open(filepath, 'wb') as f:
        f.write(file_response.content)

print('Download complete!')

Automated Download Script

Set up scheduled downloads:

import requests
import os
from datetime import datetime
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

def download_custom_products(api_key, output_dir):
    """Download all available custom products."""
    headers = {'spire-api-key': api_key}
    base_url = 'https://api.wx.spire.com/custom/file'

    # Get file list
    response = requests.get(base_url, headers=headers)
    response.raise_for_status()

    files = response.json()['files']
    logger.info(f"Found {len(files)} files")

    downloaded = []
    for filename in files:
        filepath = os.path.join(output_dir, filename)

        # Skip if already exists
        if os.path.exists(filepath):
            logger.debug(f"Skipping (exists): {filename}")
            continue

        logger.info(f"Downloading: {filename}")
        file_response = requests.get(
            f'{base_url}/{filename}',
            headers=headers,
            allow_redirects=True
        )
        file_response.raise_for_status()

        with open(filepath, 'wb') as f:
            f.write(file_response.content)

        downloaded.append(filename)

    return downloaded

if __name__ == '__main__':
    import os

    api_key = os.environ.get('SPIRE_API_KEY')
    if not api_key:
        raise ValueError("Set SPIRE_API_KEY environment variable")

    output_dir = 'custom_data'
    os.makedirs(output_dir, exist_ok=True)

    downloaded = download_custom_products(api_key, output_dir)
    print(f"Downloaded {len(downloaded)} new files")

Sample Products

For evaluation purposes, sample forecast files may be available:

GET /sample/file

This endpoint provides sample data for testing your integration before purchasing a subscription.

Shell
Python
Node.js
curl -X GET \
  'https://api.wx.spire.com/sample/file' \
  -H 'spire-api-key: YOUR_API_KEY'

Support

For questions about custom products or to configure new products: