API process flow
Create Project
Create Project
Before uploading an audio or video file, you must have an existing project. Use the createProject mutation to create a new one. Once created, you can import audio and video files into it and begin generating protocols.
GraphQL Mutation
mutation CreateProject($name: String!) {
createProject(name: $name) {
project {
slug
name
}
}
}
Mutation Variables
{
"name": "My New Project"
}
Example JavaScript Implementation
import axios from "axios";
const CREATE_PROJECT_MUTATION = `
mutation CreateProject($name: String!) {
createProject(name: $name) {
project {
slug
name
}
}
}
`;
const createProject = async (name) => {
try {
const response = 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: CREATE_PROJECT_MUTATION,
variables: { name },
}),
});
console.log("Created Project:", response.data.data.createProject.project);
} catch (error) {
console.error("Error creating project:", error);
}
};
createProject("My New Project");
Notes
- The returned
slugis required in subsequent calls such asinitProtocol. - Project names do not need to be unique, but a descriptive name helps with organisation.
Have questions?
Still have questions? Talk to support.