Optional calls
Get Usage Records
Get Usage Records
Use the getUsageRecordsByApiKey query to retrieve all usage records associated with the authenticated API key. This is useful for tracking consumption and auditing usage over time.
No input parameters are required — records are automatically scoped to the API key used in the request header.
GraphQL Query
query GetUsageRecordsByApiKey {
getUsageRecordsByApiKey {
id
email
amount
createdAt
}
}
Example JavaScript Implementation
import axios from "axios";
const GET_USAGE_RECORDS_BY_API_KEY = `
query GetUsageRecordsByApiKey {
getUsageRecordsByApiKey {
id
email
amount
createdAt
}
}
`;
const getUsageRecordsByApiKey = async () => {
const res = await axios({
method: "POST",
url: "https://api-v2.speechmind.com/external/v2/graphql",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.SPEECHMIND_API_KEY,
},
data: JSON.stringify({
query: GET_USAGE_RECORDS_BY_API_KEY,
}),
});
const records = res.data.data.getUsageRecordsByApiKey;
console.log("Usage Records:", records);
return records;
};
Notes
id— unique identifier of the usage record.email— the email associated with the usage entry.amount— the usage amount recorded (e.g. minutes processed).createdAt— timestamp of when the usage was recorded.
Have questions?
Still have questions? Talk to support.