GraphQL API reference

Labelbox uses GraphQL API internally. Some of the GraphQL API methods are publicly exposed for developers to integrate their ML pipeline with Labelbox. While Python SDK is recommended choice for integration, it may not support various features that you see in the Labelbox app. In those scenarios, you can create and use your preferred GraphQL queries and use it with the Python SDK.

Using GraphQL queries with Python SDK

Use GraphQL API explorer to find and test the appropriate query before using it with the Python SDK. Below is an example of using the GraphQL query.

from labelbox import Client
client = Client()

## GraphQL query
query_str = """mutation setprojectinsructionsPyApi($projectId: ID!, $instructions_url: String!) {
                setProjectInstructions(
                    where: {id: $projectId},
                    data: {instructionsUrl: $instructions_url}
                ) {
                    id
                    ontology {
                    id
                    options
                    }
                }
            }"""



self.client.execute(query_str, {
    'projectId': self.uid,
    'instructions_url': instructions_url
})