Skip to main content
The Cobo CLI provides a powerful GraphQL interface to interact with the Cobo WaaS 2 API. This feature allows you to execute complex queries and retrieve specific data from the API.

Execute a GraphQL Query

To execute a GraphQL query, use the graphql command followed by your query. The basic syntax is:
Replace YOUR_QUERY_HERE with your actual GraphQL query.

Query Structure

Your GraphQL query should be a valid JSON string containing a query key. For example:
If your query is a simple string (not JSON), the CLI will automatically wrap it in the required JSON structure.

Use Variables

You can include variables in your GraphQL query using the -v or --variables option. The variables should be provided as a JSON string. For example:

Raw Output

By default, the CLI formats the JSON response for readability. If you prefer the raw JSON output, use the --raw flag:

Example Queries

Here are some example GraphQL queries you can try with the Cobo WaaS 2 API:

Fetch Wallet Information

Retrieve Transactions for a Wallet

Get MPC Vault Information with Variables

Error Handling

If there’s an error in your GraphQL query or during execution, the CLI will display the error message. Make sure to check the response for any error fields.
Always validate your queries before executing them in a production environment to avoid potential issues.

Tips for Using GraphQL with Cobo CLI

  1. Use the --help option with the graphql command to see all available options:
  2. For complex queries, consider writing your query in a separate file and using command substitution to pass it to the CLI:
  3. Remember to escape special characters in your query string when using it directly in the command line.
  4. The GraphQL endpoint uses the same authentication method as other API commands. Ensure you’re properly authenticated before executing queries.
  5. Use the Cobo WaaS 2 API documentation to explore available GraphQL schemas and construct your queries accordingly.
By leveraging the power of GraphQL, you can efficiently retrieve exactly the data you need from the Cobo WaaS 2 API, reducing unnecessary data transfer and simplifying your API interactions.
  • cobo get: Execute GET requests to the Cobo API
  • cobo post: Execute POST requests to the Cobo API
  • cobo put: Execute PUT requests to the Cobo API
  • cobo delete: Execute DELETE requests to the Cobo API
For more information on these commands, refer to their respective documentation pages.