We've made API version 2 available for beta testing. We do not recommend it for production use at this time, but would appreciate your feedback.
Please visit our help article to learn how to create an API key.
API V2 is designed to provide a faster an more flexible way of accessing Drata. There are several differences from V1:
async function fetchAll() {
// The first request doesn't send a value for the cursor.
let cursor = undefined;
do {
const query = new URLSearchParams({ cursor });
const resp = await fetch(
`https://public-api.drata.com/public/v2/users?${query}`,
{
method: 'GET',
headers: { Authorization: 'Bearer <YOUR_API_KEY_HERE>' }
}
);
const data = await resp.json();
console.log(data);
// If there's a cursor value returned, then there are more results.
// Pass that back as a query parameter to get the next page of data.
cursor = data?.pagination?.cursor;
} while (cursor)
}
fetchAll();
expand
query parameter that let's you specify which related objects and collections you want to expand.