Drata API – Beta 🧪 (V2)

Download OpenAPI specification:Download

Beta Status

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.

Getting Started

Please visit our help article to learn how to create an API key.

Upgrading From Version 1

API V2 is designed to provide a faster an more flexible way of accessing Drata. There are several differences from V1:

  • The listing endpoints now use cursor based pagination. This provides faster responses and ensures that all records can be retrieved even, if they are changed during the process.
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();
  • You'll notice smaller responses. Most endpoints accept an expand query parameter that let's you specify which related objects and collections you want to expand.