menu button

API process flow

Get All Projects

Get All Projects

Projects work like repositories — one user can have multiple projects, and each project can hold multiple protocols. You must have at least one project before creating a protocol.

Use the getAllProjects query to retrieve all projects for the authenticated user. If no projects exist yet, create one first using createProject.


GraphQL Query

query GetAllProjects {
  getAllProjects {
    slug
    name
  }
}

Example JavaScript Implementation

import axios from "axios";

const GET_ALL_PROJECTS = `
  query GetAllProjects {
    getAllProjects {
      slug
      name
    }
  }
`;

const getAllProjects = async () => {
  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: GET_ALL_PROJECTS,
      }),
    });

    console.log("Projects:", response.data.data.getAllProjects);
  } catch (error) {
    console.error("Error fetching projects:", error);
  }
};

getAllProjects();

Notes

  • The returned slug is required in subsequent calls such as createProject and initProtocol.
  • If the response is an empty array, no projects exist yet — use createProject to create one.

Have questions?

Still have questions? Talk to support.