Quickstart
In this guide you will find one well, copy its asset_id, and retrieve the latest record from a dataset. You need read access through an API key or Bearer token.
1. Choose and store your authorization
The examples use an API key. Set it as an environment variable so it does not appear in your source code. Follow your organization's shell-history and secret-management policy when setting its value.
export CORVA_API_KEY='YOUR_API_KEY'
Every request in this guide sends it through the Authorization header:
Authorization: API YOUR_API_KEY
Bearer tokens are also supported: replace the value with Bearer YOUR_JWT. See Authentication for API key creation, credential-based token generation, refresh, and security guidance.
2. Find a well
https://api.corva.ai/v2/wellsThe request returns one visible well and only the fields needed for the next step.
- cURL
- Python
- JavaScript
curl --get 'https://api.corva.ai/v2/wells' \
--header "Authorization: API ${CORVA_API_KEY}" \
--data-urlencode 'per_page=1' \
--data-urlencode 'visibility=visible' \
--data-urlencode 'fields[]=well.name' \
--data-urlencode 'fields[]=well.asset_id'
import os
import requests
response = requests.get(
"https://api.corva.ai/v2/wells",
headers={"Authorization": f"API {os.environ['CORVA_API_KEY']}"},
params={
"per_page": 1,
"visibility": "visible",
"fields[]": ["well.name", "well.asset_id"],
},
timeout=30,
)
response.raise_for_status()
print(response.json())
const params = new URLSearchParams({ per_page: '1', visibility: 'visible' });
params.append('fields[]', 'well.name');
params.append('fields[]', 'well.asset_id');
const response = await fetch(`https://api.corva.ai/v2/wells?${params}`, {
headers: { Authorization: `API ${process.env.CORVA_API_KEY}` },
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.json());
A successful response contains the selected well fields. Copy the asset_id value from attributes; it identifies the well in dataset records.
{
"data": [
{
"type": "well",
"attributes": {
"name": "Example Well",
"asset_id": 12345
}
}
]
}
3. Read the latest dataset record
Replace 12345 with the asset_id returned above.
https://data.corva.ai/api/v1/data/corva/wits/- cURL
- Python
- JavaScript
curl --get 'https://data.corva.ai/api/v1/data/corva/wits/' \
--header "Authorization: API ${CORVA_API_KEY}" \
--data-urlencode 'query={"asset_id":12345}' \
--data-urlencode 'sort={"timestamp":-1}' \
--data-urlencode 'limit=1'
import json
import os
import requests
response = requests.get(
"https://data.corva.ai/api/v1/data/corva/wits/",
headers={"Authorization": f"API {os.environ['CORVA_API_KEY']}"},
params={
"query": json.dumps({"asset_id": 12345}),
"sort": json.dumps({"timestamp": -1}),
"limit": 1,
},
timeout=30,
)
response.raise_for_status()
print(response.json())
const params = new URLSearchParams({
query: JSON.stringify({ asset_id: 12345 }),
sort: JSON.stringify({ timestamp: -1 }),
limit: '1',
});
const response = await fetch(
`https://data.corva.ai/api/v1/data/corva/wits/?${params}`,
{ headers: { Authorization: `API ${process.env.CORVA_API_KEY}` } }
);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.json());
The Data API returns an array. An empty array means the request succeeded but no records matched the selected well and dataset.
Next steps
- Learn the available query controls.
- Use a complete drilling, completion, or drillout Python workflow.
- Use the maintained Platform API and Data API references for verified parameters and examples.