This page serves to document the timeseries request endpoint for the Hydrocron API. The timeseries endpoint retrieves time series data from SWOT observations for reaches and nodes based on a user request which can include the headers and query parameters documented below under “Request Headers” and “Request Parameters”.
The timeseries endpoint returns a CSV or GeoJSON response depending on the user request, see “Response Format” below. If something goes wrong the timeseries endpoint returns different response codes to indicate to the user what might have caused an error, see “Response Codes” below.
For more information on using request headers when working with an API like Hydrocron programatically, see: https://
Request Headers¶
Accept¶
Accept headers provide more control over the output that is returned by Hydrocron. You can pass the Accept header in your request to return a specific response format.
Accept headers: application/json, text/csv, application/geo+json
Possible header and request parameter combinations:
If the Accept header is
text/csvorapplication/geo+json, the raw CSV or GeoJSON response is returned.If the Accept header is
application/jsonwith an output field ofgeojson, the entire JSON object with metadata including GeoJSON response is returned.If the Accept header is
application/jsonwith an output field ofcsv, the entire JSON object with metadata including CSV response is returned.If the Accept header is
application/jsonwithout an output field, the entire JSON object with metadata including GeoJSON response is returned.If the Accept header is none of the accepted types then a 415 Unsupported is returned.
If no Accept header is passed in the request then the default is to return
application/jsonwith metadata. Theoutputfield is used to determine whether a GeoJSON or CSV response is returned in theresultsfield of the response.
Example GeoJSON request and response:
curl -v --header "Accept: application/geo+json" --location 'https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=63470800171&start_time=2024-02-01T00:00:00%2b00:00&end_time=2024-10-30T00:00:00%2b00:00&fields=reach_id,time_str,wse'Content-Type: ‘application/geo+json’
{
"type": "FeatureCollection",
"features": [
{
"id": "0",
"type": "Feature",
"properties": {
"reach_id": ["63470800171", "63470800171", "63470800171", ...],
"time_str": ["2024-02-08T13:48:48Z", "2024-02-12T00:49:59Z", "2024-02-29T10:33:53Z", ...],
"wse": ["493.9646", "495.8134", "489.3664", ...],
"wse_units": ["m", "m", "m", ...]
},
"geometry": {
"type": "LineString",
"coordinates": [[-46.100781, -15.940864], [-46.101059, -15.940592], ...295 total...]
}
}
]
}Example CSV request and response:
curl -v --header "Accept: text/csv" --location 'https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=63470800171&start_time=2024-02-01T00:00:00%2b00:00&end_time=2024-10-30T00:00:00%2b00:00&fields=reach_id,time_str,wse'Content-Type: text/csv
"reach_id,time_str,wse,wse_units\n63470800171,2024-02-08T13:48:48Z,493.9646,m\n63470800171,2024-02-12T00:49:59Z,495.8134,m\n...\n"Request Parameters¶
feature : string, required: yes¶
Type of feature being requested. Either: “Reach”, “Node” or “PriorLake”
feature_id : string, required: yes¶
ID of the feature to retrieve
Reaches have the format CBBBBBRRRRT (e.g., 78340600051)
Nodes have the format CBBBBBRRRRNNNT (e.g., 12228200110861)
PriorLakes have the format CBBNNNNNNT (e.g., 2710046612)
Please see the SWOT Product Description Document for the L2_HR_RiverSP Dataset for more information on reach and node identifiers. Please see the SWOT Product Description Document for the L2_HR_LakeSP Dataset for more information on lake identifiers.
start_time : string, required: yes¶
Start time of the time series in the form of YYYY-MM-DDTHH:MM:SSZ (e.g., 2023-08-04T00:00:00Z)
The time can include a UTC offset which is specified in the form of ±HH:MM or ±HHMM so the entire time format can be: YYYY-MM-DDTHH:MM:SSZ±HH:MM.
Please note you will need to encode offsets that use the + sign with %2b so that the parameters in the URL used to query the API passes the correct character to the API.
Example:
/timeseries?feature=Reach&feature_id=78340600051&output=geojson&start_time=2024-01-25T00:00:00%2b00:00&end_time=2024-03-29T00:00:00%2b00:00&fields=reach_id,time_str,wse,slope
end_time : string, required: yes¶
End time of the time series in the form of YYYY-MM-DDTHH:MM:SSZ (e.g., 2024-01-25T00:00:00Z)
The time can include a UTC offset which is specified in the form of ±HH:MM or ±HHMM so the entire time format can be: YYYY-MM-DDTHH:MM:SSZ±HH:MM.
Please note you will need to encode offsets that use the + sign with %2b so that the parameters in the URL used to query the API passes the correct character to the API.
Example:
/timeseries?feature=Reach&feature_id=78340600051&output=geojson&start_time=2024-01-25T00:00:00%2b00:00&end_time=2024-03-29T00:00:00%2b00:00&fields=reach_id,time_str,wse,slope
output : string, required: no¶
Format of the data returned. One of: geojson, csv, csv_file.
geojson(default) — returns GeoJSON in theresultsfield of the JSON responsecsv— returns CSV in theresultsfield of the JSON responsecsv_file— returns the data as a CSV file download (the browser prompts to save it)
Use output only with no Accept header, */*, or application/json. Setting output with the Accept header text/csv or application/geo+json returns a 400.
filename : string, required: no¶
Custom filename for the downloaded CSV file. Only used when output=csv_file. If not provided, a default filename is generated in the format: hydrocron_{feature}_{feature_id}_{start_date}_{end_date}.csv
For reach and node requests (node_fields), the default is hydrocron_Reach_nodes_{feature_id}_{start_date}_{end_date}.csv.
The filename is sanitized to only allow safe characters (a-z, A-Z, 0-9, _, -, .). If the filename does not end with .csv, the extension is appended automatically. Maximum length is 200 characters.
compact: string, required: no¶
Whether to return a ‘compact’ GeoJSON response. Either: “true” or “false”
The default for header Accept: application/geo+json is to set compact to true if it is not provided. The default header for application/json is to set compact to false if it is not provided. See “Response” section for details on the returned compact response.
collection_name: string, required: no¶
The name of the collection to query. Allows users to request data from a specific version or feature type. If omitted, defaults to a Version D collection.
| Collection Name | Version | Scope |
|---|---|---|
SWOT_L2_HR_RiverSP_D | D (default) | All river data (reaches and nodes) |
SWOT_L2_HR_RiverSP_reach_D | D | Reaches only |
SWOT_L2_HR_RiverSP_node_D | D | Nodes only |
SWOT_L2_HR_LakeSP_D | D (default) | Lake data |
SWOT_L2_HR_LakeSP_prior_D | D | Prior lakes only |
SWOT_L2_HR_RiverSP_2.0 | 2.0 | Reaches only, Version 2.0 reach fields (reach ID, SoS Discharge, times, some SWORD fields). Nodes retired (returns HTTP 410) |
SWOT_L2_HR_RiverSP_reach_2.0 | 2.0 | Same as SWOT_L2_HR_RiverSP_2.0 |
SWOT_L2_HR_RiverSP_node_2.0 | 2.0 | Retired (returns HTTP 410) |
SWOT_L2_HR_LakeSP_2.0 | 2.0 | Retired (returns HTTP 410) |
SWOT_L2_HR_LakeSP_prior_2.0 | 2.0 | Retired (returns HTTP 410) |
fields : string, required: yes¶
The SWOT data fields to return in the request.
This is specified in the form of a comma separated list: fields=reach_id,time_str,wse,slope
Hydrocron includes additional fields beyond the source data shapefile attributes, including units fields on measurements, cycle and pass information, SWORD and PLD (prior river and lake database names), and collection versions. NOTE: Units are always returned for fields that have corresponding units stored in Hydrocron, they do not need to be requested. The complete list of input fields that are available through Hydrocron are described in the Fields section.
SoS Discharge fields are served only on Version 2.0 reaches: use feature=Reach and collection_name=SWOT_L2_HR_RiverSP_2.0, which serves only the Version 2.0 reach fields. See the discharge guide.
node_fields : string, required: no¶
Return a reach and all of its nodes in one request. Only valid with feature=Reach.
When node_fields is present, the response contains the reach’s time series and the time series of every node on that reach. fields sets the reach columns and node_fields sets the node columns, in the same comma separated form: node_fields=node_id,time_str,wse,node_q
Valid node fields are listed in the Fields section. Units are returned automatically, as with
fields.Nodes come from the same collection version as the reach (
collection_name), sonode_fieldsworks with Version D only.An HTTP 400 (Bad Request) error is returned if
node_fieldsis used withfeature=Nodeorfeature=PriorLake, is empty, or contains a field that is not a node field.An HTTP 410 (Gone) error is returned if
node_fieldsis used with a Version 2.0 collection.An HTTP 413 (Payload Too Large) error is returned if the reach has more than 25,000 node rows in the requested time range. Reduce the time range.
Responses are also limited to 6 MB, which GeoJSON often reaches well before 25,000 rows. For long time ranges use CSV and request only the fields you need. The 413 message says which limit was hit.
See Reach and node responses for the response layout.
Response Format¶
Default¶
This includes cases where Accept header is not included or equals */* or application/json.
Returns a JSON response that contains CSV or GeoJSON in results object with a Content-Type set to ‘application/json’.
If the user sends a request parameter of output=csv then the results object will contain CSV data of the requested fields.
Example CSV response:
{
"status": "200 OK",
"time": 697.498,
"hits": 10,
"results": {
"csv": "reach_id,time_str,wse,wse_units\n78340600051,2024-02-03T18:34:05Z,386.9557,m\n78340600051,2024-02-09T08:00:46Z,-999999999999.0,m\n...\n",
"geojson": {}
}
}If the user sends a request parameter of output=geojson then the results object will contain GeoJSON data of the requested fields.
Example JSON response:
{
"status": "200 OK",
"time": 723.004,
"hits": 25,
"results": {
"csv": "",
"geojson": {
"type": "FeatureCollection",
"features": [
{
"id": "0",
"type": "Feature",
"properties": {
"reach_id": "63470800171",
"time_str": "2024-02-08T13:48:48Z",
"wse": "493.9646",
"wse_units": "m"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-46.100781, -15.940864],
"...",
[-46.122559, -15.875454]
]
}
},
{
"id": "1",
"type": "Feature",
"properties": {
"reach_id": "63470800171",
"time_str": "2024-02-12T00:49:59Z",
"wse": "495.8134",
"wse_units": "m"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-46.100781, -15.940864],
"...",
[-46.122559, -15.875454]
]
}
}
]
}
}
}If the user sends a request parameter of compact=true and the request parameter output=geojson, the response will be compacted. The compacted response appends time series data into a single list for each requested field and is stored under the properties object in the results object.
Only one Feature is ever returned as the data is aggregated under a single “Feature”. The geometry for the data is included in the response’s geometry object which is listed once as there is only one Feature represented in the response.
Example compacted JSON response:
{
"status": "200 OK",
"time": 2175.824,
"hits": 25,
"results": {
"csv": "",
"geojson": {
"type": "FeatureCollection",
"features": [
{
"id": "0",
"type": "Feature",
"properties": {
"reach_id": [
"63470800171",
"63470800171",
"..."
],
"time_str": [
"2024-02-08T13:48:48Z",
"2024-02-12T00:49:59Z",
"..."
],
"wse": [
"493.9646",
"495.8134",
"..."
],
"wse_units": [
"m",
"m",
"..."
]
},
"geometry": {
"type": "LineString",
"coordinates": [
[-46.100781, -15.940864],
"...",
[-46.122559, -15.875454]
]
}
}
]
}
}
}application/geo+json¶
When the Accept header is set to application/geo+json and there is no output request parameter, a GeoJSON response is returned with a Content-Type set to ‘application/geo+json’.
The default behavior is to compact the response into a single “Feature”. The compacted response appends time series data into a single list for each requested field and includes a single geometry object for the data.
Example compacted GeoJSON response:
{
"type": "FeatureCollection",
"features": [
{
"id": "0",
"type": "Feature",
"properties": {
"reach_id": [
"63470800171",
"63470800171",
"..."
],
"time_str": [
"2024-02-08T13:48:48Z",
"2024-02-12T00:49:59Z",
"..."
],
"wse": [
"493.9646",
"495.8134",
"..."
],
"wse_units": [
"m",
"m",
"..."
]
},
"geometry": {
"type": "LineString",
"coordinates": [
[-46.100781, -15.940864],
"...",
[-46.122559, -15.875454]
]
}
}
]
}If the user sends a request parameter of compact=false then the GeoJSON response will not be compacted and there will be one “Feature” per time step.
Example GeoJSON response that is not compacted:
{
"type": "FeatureCollection",
"features": [
{
"id": "0",
"type": "Feature",
"properties": {
"reach_id": "63470800171",
"time_str": "2024-02-08T13:48:48Z",
"wse": "493.9646",
"wse_units": "m"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-46.100781, -15.940864],
"...",
[-46.122559, -15.875454]
]
}
},
{
"id": "1",
"type": "Feature",
"properties": {
"reach_id": "63470800171",
"time_str": "2024-02-12T00:49:59Z",
"wse": "495.8134",
"wse_units": "m"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-46.100781, -15.940864],
"...",
[-46.122559, -15.875454]
]
}
}
]
}text/csv¶
When the Accept header is set to text/csv and there is no output request parameter, a CSV response is returned with Content-Type set to ‘text/csv’.
Example CSV response:
"reach_id,time_str,wse,wse_units\n63470800171,2024-02-08T13:48:48Z,493.9646,m\n63470800171,2024-02-12T00:49:59Z,495.8134,m\n...\n"CSV File Download¶
When the output parameter is set to csv_file, the response triggers a file download in the browser. The response has Content-Type: text/csv and a Content-Disposition: attachment; filename=... header that causes the browser to prompt a Save As dialog.
Example request with default filename:
curl -OJ --location 'https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=63470800171&start_time=2024-02-01T00:00:00%2b00:00&end_time=2024-10-30T00:00:00%2b00:00&output=csv_file&fields=reach_id,time_str,wse'Downloads as: hydrocron_Reach_63470800171_2024-02-01_2024-10-30.csv
Example request with custom filename:
curl -OJ --location 'https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=63470800171&start_time=2024-02-01T00:00:00%2b00:00&end_time=2024-10-30T00:00:00%2b00:00&output=csv_file&filename=my_analysis&fields=reach_id,time_str,wse'Downloads as: my_analysis.csv
Reach and node responses¶
When node_fields is present, every response format (JSON, GeoJSON, CSV, CSV file download) holds both the reach and its nodes. In GeoJSON, “rows” below means Features and “columns” means properties.
Rows: reach rows first, then node rows in
node_idorder. Each node’s rows are in time order.Added columns: every row starts with
feature_type,reach_idandnode_id(node rows), even if not requested.feature_typeisReachorNode(the same values as thefeatureparameter).Column order:
feature_type,reach_id,node_id, then the requestedfields, then any new fields fromnode_fields, then units. A field in both lists appears once.Empty CSV columns: CSV has one header for all rows, so a column that doesn’t apply to a row’s feature type is empty (e.g.
node_idandnode_qon the reach row,slopeon node rows). Real missing values still use the fill value-999999999999.0.Units: unit columns come from the rows returned. In CSV, if only the reach or only nodes have data, the other feature type’s requested fields still appear (empty), but their unit columns may not.
Unobserved nodes are included with
time_strofno_dataand fill values, the same asfeature=Noderequests.Geometry: GeoJSON always includes it — a LineString for the reach and a Point for each node. CSV includes it only if
geometryis requested (infieldsfor reach rows, innode_fieldsfor node rows).Compact:
compact=truereturns one Feature for the reach and one for each node, each with its values as lists.hits: the total number of reach and node rows, before compaction.If only the reach or only nodes have data in the time range, that data is returned. A 400 is returned only if neither has data.
Example CSV request (Version D reach 57203000041, one pass):
curl --header "Accept: text/csv" --location 'https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=57203000041&start_time=2026-04-19T00:00:00Z&end_time=2026-04-20T00:00:00Z&fields=reach_id,time_str,wse,slope&node_fields=node_id,time_str,wse,node_q'"feature_type,reach_id,node_id,time_str,wse,slope,node_q,wse_units,slope_units\nReach,57203000041,,2026-04-19T19:08:16Z,7.6096,0.00135545806,,m,m/m\nNode,57203000041,57203000040011,no_data,-999999999999.0,,3,m,\n...\nNode,57203000041,57203000040201,2026-04-19T19:08:16Z,6.06841,,0,m,\n...\n"The reach row has an empty node_id and node_q; node rows have an empty slope and slope_units. Node 57203000040011 was not observed on this pass, so it has no_data and fill values.
Example compact GeoJSON response for the same request with Accept: application/geo+json (2 of the 52 node Features shown):
{
"type": "FeatureCollection",
"features": [
{
"id": "0",
"type": "Feature",
"properties": {
"feature_type": ["Reach"],
"reach_id": ["57203000041"],
"time_str": ["2026-04-19T19:08:16Z"],
"wse": ["7.6096"],
"slope": ["0.00135545806"],
"wse_units": ["m"],
"slope_units": ["m/m"]
},
"geometry": {
"type": "LineString",
"coordinates": [[171.24103, -42.454014], [171.241175, -42.453743], "...", [171.341708, -42.437007]]
}
},
{
"id": "1",
"type": "Feature",
"properties": {
"feature_type": ["Node"],
"reach_id": ["57203000041"],
"node_id": ["57203000040011"],
"time_str": ["no_data"],
"wse": ["-999999999999.0"],
"node_q": ["3"],
"wse_units": ["m"]
},
"geometry": {"type": "Point", "coordinates": [171.241318, -42.452933]}
},
"...",
{
"id": "20",
"type": "Feature",
"properties": {
"feature_type": ["Node"],
"reach_id": ["57203000041"],
"node_id": ["57203000040201"],
"time_str": ["2026-04-19T19:08:16Z"],
"wse": ["6.06841"],
"node_q": ["0"],
"wse_units": ["m"]
},
"geometry": {"type": "Point", "coordinates": [171.280862, -42.452075]}
},
"..."
]
}Response Codes¶
| Code | Reason |
|---|---|
| 200 | Request has succeeded and response has been returned to the user. |
| 400* | ‘Bad Request’: This indicates that the end user entered the parameters incorrectly in their query or time series data could not be located for the feature ID. The API attempts to send a response as to which parameter was incorrect. |
| 410 | ‘Gone’: The requested Version 2.0 data has been retired: a Version 2.0 node or lake collection, feature=Node or node_fields with a Version 2.0 river collection, or a reach field that is not in the Version 2.0 reach fields. The message names the collection to use instead. |
| 413 | ‘Payload Too Large’: The user attempted to retrieve a response that was too large. This is triggered for queries that exceed 6mb, and for node_fields requests where the reach has more than 25,000 node rows in the time range. |
| 415 | ‘Unsupported Media Type’: The user sends an invalid Accept header. |
| 500 | ‘Internal Server Error’: Internal API error. The message includes a request ID; please include it when you report the error on GitHub. |
| 503 | ‘Service Unavailable’: The service is busy. Retry in a few seconds. |
| 504 | ‘Gateway Timeout’: The request took longer than 29 seconds. This can happen with node_fields requests that ask for many fields over a long time range. Reduce the time range or the number of fields. |
*The 400 code is also currently returned for queries where no time series data could be located for the request specified feature ID. The message returned with the response indicates this and it can be helpful to adjust the date ranges you are searching.
API Keys¶
Users may request a special API key for cases where their intended usage of the API may be considered heavy or more complex. Heavy usage can be defined as continued use with many requests per hour or day or continued use which may require many requests per second or concurrent requests. To request an API key or to discuss your use case, please submit a GitHub issue.
Note: Users do not have to send an API key in their request to use the Hydrocron API. The API key is optional.
How to use an API key in requests¶
Hydrocron API key header: x-hydrocron-key
After receiving the API key, users may send the API key in their request under the x-hydrocron-key header.
Example
curl --header 'x-hydrocron-key: <podaac-provided-api-key>' --location 'https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries?feature=Reach&feature_id=63470800171&start_time=2024-02-01T00:00:00%2b00:00&end_time=2024-10-30T00:00:00%2b00:00&fields=reach_id,time_str,wse'Replace <podaac-provided-api-key> with the API key provided to you.
Python Example
import requests
url = "https://soto.podaac.earthdatacloud.nasa.gov/hydrocron/v1/timeseries"
headers = {
"x-hydrocron-key": "<podaac-provided-api-key>"
}
params = {
"feature": "Reach",
"feature_id": "63470800171",
"output": "csv",
"start_time": "2024-02-01T00:00:00%2b00:00",
"end_time": "2024-10-30T00:00:00%2b00:00",
"fields": "reach_id,time_str,wse,slope,width"
}
response = requests.get(url=url, headers=headers, params=params)Replace <podaac-provided-api-key> with the API key provided to you.