Skip to content

Location API ​

Access Restriction

This API is a premium service available only to enterprise tier developers. Please contact Caiyun Sales to purchase.

TIP

CAP weather alerts are currently supported for the United States. Other countries and regions are being added gradually.

Each request consumes one API call quota.

Request ​

http
GET https://singer.caiyunhub.com/v3/cap_alert/location

Query Parameters ​

NameRequiredDefaultRangeDescription
tokenYes——API token; see Authentication
longitudeYes——Longitude
latitudeYes——Latitude
languageNozh-CNBCP 47 language tagResponse text language

Request Example ​

bash
curl "https://singer.caiyunhub.com/v3/cap_alert/location?token={token}&longitude=-118.25&latitude=34.05&language=en-US"

Response Example ​

json
{
  "alerts": [
    {
      "id": "nws-alert-1",
      "region_code": "US",
      "source": 1,
      "msg_type": 1,
      "event_name": "Flash Flood Warning",
      "categories": [2],
      "urgency": 1,
      "severity": 2,
      "certainty": 2,
      "sent_time": 1750123200,
      "effective_time": 1750123200,
      "onset_time": 1750125000,
      "expires_time": 1750130400,
      "references": [],
      "areas": [
        {
          "area_desc": "Los Angeles",
          "geocodes": [
            {
              "value_name": "UGC",
              "value": "CAC037",
              "namespace": "NWS_UGC"
            }
          ],
          "polygons": [
            {
              "vertices": [
                { "latitude": 34.11, "longitude": -118.45 },
                { "latitude": 34.10, "longitude": -118.10 },
                { "latitude": 33.90, "longitude": -118.12 }
              ]
            }
          ],
          "circles": [
            {
              "center": { "latitude": 34.05, "longitude": -118.25 },
              "radius_km": 10
            }
          ]
        }
      ],
      "language_code": "en-US",
      "sender_name": "NWS Los Angeles/Oxnard CA",
      "headline": "Flash Flood Warning issued for Los Angeles",
      "description": "Flash flooding caused by excessive rainfall is expected.",
      "instruction": "Move to higher ground immediately."
    }
  ]
}

Response Fields ​

CAPAlerts ​

JSONPathTypeDescription
$.alertsarray<object>CAP weather alert records

CAPAlert ​

JSONPathTypeDescription
$.alerts[].idstringUnique alert identifier. Do not parse it for business logic.
$.alerts[].region_codestringISO 3166-1 Alpha-2 code
$.alerts[].sourcenumberAlert source. See CAPAlertSource
$.alerts[].msg_typenumberCAP msgType. See CAPAlertMsgType
$.alerts[].event_namestringEvent name, preferring the selected response language
$.alerts[].categoriesarray<number>CAP info.category. Currently only the Met type is returned. See CAPAlertCategory
$.alerts[].urgencynumberCAP info.urgency. See CAPAlertUrgency
$.alerts[].severitynumberCAP info.severity. See CAPAlertSeverity
$.alerts[].certaintynumberCAP info.certainty. See CAPAlertCertainty
$.alerts[].sent_timenumberSent timestamp in seconds
$.alerts[].effective_timenumberEffective timestamp in seconds
$.alerts[].onset_timenumberOnset timestamp in seconds
$.alerts[].expires_timenumberExpiration timestamp in seconds
$.alerts[].referencesarray<string>CAP references
$.alerts[].areasarray<object>Affected areas
$.alerts[].language_codestringLanguage code of the returned text
$.alerts[].sender_namestringSender name
$.alerts[].headlinestringHeadline
$.alerts[].descriptionstringAlert description
$.alerts[].instructionstringRecommended instructions

CAPAlertArea ​

JSONPathTypeDescription
$.alerts[].areas[].area_descstringArea description
$.alerts[].areas[].geocodesarray<object>Area geocodes
$.alerts[].areas[].polygonsarray<object>Polygon geometries
$.alerts[].areas[].circlesarray<object>Circle geometries
$.alerts[].areas[].altitudenumberCAP altitude, in meters
$.alerts[].areas[].ceilingnumberCAP ceiling, in meters

CAPAlertGeocode ​

JSONPathTypeDescription
$.alerts[].areas[].geocodes[].value_namestringGeocode name
$.alerts[].areas[].geocodes[].valuestringGeocode value
$.alerts[].areas[].geocodes[].namespacestringGeocode namespace

CAPAlertPolygon ​

JSONPathTypeDescription
$.alerts[].areas[].polygons[].verticesarray<object>Polygon vertices with latitude/longitude fields

CAPAlertCircle ​

JSONPathTypeDescription
$.alerts[].areas[].circles[].centerobjectCircle center with latitude/longitude fields
$.alerts[].areas[].circles[].radius_kmnumberRadius in kilometers

CAPAlertSource ​

New enum values may be added at any time. Code should handle unknown values.

NumberDescription
1US National Weather Service
2Environment and Climate Change Canada

CAPAlertMsgType ​

NumberDescription
1Alert
2Update
3Cancel

CAPAlertCategory ​

NumberDescription
1Geo
2Met
3Safety
4Security
5Rescue
6Fire
7Health
8Env
9Transport
10Infra
11CBRNE
12Other

CAPAlertUrgency ​

NumberDescription
1Immediate
2Expected
3Future
4Past
5Unknown

CAPAlertSeverity ​

NumberDescription
1Extreme
2Severe
3Moderate
4Minor
5Unknown

CAPAlertCertainty ​

NumberDescription
1Observed
2Likely
3Possible
4Unlikely
5Unknown