Resources
GraphQL API

GraphQL API

The GraphQL API is useful for fetching workspace and user metadata including recordings, users that belong to a team, and comments added to a recording.

💡

The GraphQL API is not used for programmatically debugging a recording. If you’d like to learn more about the Debugging Protocol, checkout the docs here (opens in a new tab).

try {
    const resp = await fetch("https://api.replay.io/v1/graphql", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${apiKey}`,
      },
      body: JSON.stringify({
        variables: {},
        query: query,
      }),
    });
 
    const json = await resp.json();
 
    if (json.errors) {
      throw new Error(json.errors[0].message);
    } else if (!json.data) {
      throw new Error("No data was returned");
    }
 
    return json;
  } catch (e) {
    console.log((e && e.message);
    return null;
  }
}