Docs
GraphQL API

Executing Workflows with GraphQL API

What is GraphQL?

GraphQL is an open-source data query and manipulation language developed by Facebook. It provides a more efficient, powerful, and flexible alternative to traditional REST APIs. GraphQL allows clients to define the structure of the data they need, enabling them to retrieve precisely the information they require with a single request.

GraphQL over REST

While REST APIs have been the industry standard for many years, they often suffer from over-fetching or under-fetching data, leading to inefficient data transfers and increased latency. GraphQL addresses these limitations by empowering clients to request only the data they need, reducing network overhead and improving performance.

Triggering Workflows with GraphQL

Lamatic.ai's GraphQL integration allows you to trigger your GenAI workflows seamlessly using GraphQL queries. This approach provides a standardized and efficient way to interact with our platform, enabling you to execute your GenAI workflows on-demand or as part of larger application workflows.

Here's an example GraphQL query that demonstrates how you can trigger a workflow:

query ExecuteWorkflow {
    executeWorkflow(
        workflowId: "your_workflow_id",
        payload: {
            prompt: "What is python?",
            key1: "value1",
            # ... additional key-value pairs as needed
        }
    ) {
        status
        result
    }
}

In this example, the ExecuteWorkflow query is used to initiate a workflow execution. You'll need to provide the workflowId of the desired workflow and any required payload(Input Data) as part of the query variables.

Authentication with API Keys

To ensure secure access to our platform, Lamatic.ai employs API keys for authentication. When triggering workflows via GraphQL, you'll need to include your API key in the request headers. This key serves as a unique identifier, granting you authorized access to our services while maintaining the integrity and confidentiality of your data.

Here's an example of how you can include the API key in your GraphQL request headers:

Authorization: Bearer your_api_key

By including the API key in the Authorization header, our platform can verify your identity and grant you access to trigger the desired workflow.

Click Here to know how to get your own API Key

Was this page useful?

Questions? We're here to help

Subscribe to updates