API Docs

Making Requests

Blue API uses GraphQL to provide a flexible and efficient way to interact with our API.

Reading Data

You can copy and paste the following code curl commandinto your terminal to get started, or try our Python or Node examples.

curl -X POST https://api.blue.cc/graphql \
  -H "Content-Type: application/json" \
  -H "X-Bloo-Token-ID: your-token-id" \
  -H "X-Bloo-Token-Secret: your-token-secret" \
  -H "X-Bloo-Company-ID: your-company-id" \
  -d '{
    "query": "query ProjectListQuery { projectList(filter: { companyIds: [\"your-company-id\"] }) { items {name} } }"
  }'

Now that you have made your first request, let's analyze the response. This code will return the names of the projects that you have access to in your company. The Blue API returns back data in standard JSON format that can easily be parsed by any programming language.

Sample sesponse for project list
{
  "data": {
    "projectList": {
      "items": [
        {"name": "Website Redesign"},
        {"name": "Customer Relationship Management (CRM)"},
        {"name": "Marketing Campaigns"},
        {"name": "Product Roadmap"},
        {"name": "Social Media Strategy"},
        {"name": "Client Onboarding"},
        {"name": "Sales Pipeline Management"},
        {"name": "Employee Training Program"},
        {"name": "Financial Planning and Budgeting"},
        {"name": "Content Creation and Blogging"},
        {"name": "SEO Improvements"},
        {"name": "Customer Feedback and Support"},
        {"name": "Product Feature Development"},
        {"name": "Internal Communication Tools"},
        {"name": "Inventory Management"},
        {"name": "Event Planning and Coordination"},
        {"name": "Business Growth Strategies"},
        {"name": "New Product Launch"},
        {"name": "Legal and Compliance"},
        {"name": "Performance Tracking and Reporting"}
      ]
    }
  }
}

You can add more fields to the query to get more information about the projects, such as id and the last time it was updated.

If we update the query like this:

Updated query with more fields
{ items {name, id, updatedAt} }

You will receive a JSON response with the requested data in this format:

Sample response with more fields
{
  "data": {
    "projectList": {
      "items": [
        {"id": "proj1", "name": "Website Redesign", "updatedAt": "2024-08-01T12:34:56.789Z"},
        {"id": "proj2", "name": "Customer Relationship Management (CRM)", "updatedAt": "2024-07-15T09:21:34.567Z"},
        {"id": "proj3", "name": "Marketing Campaigns", "updatedAt": "2024-06-10T14:45:23.456Z"},
        {"id": "proj4", "name": "Product Roadmap", "updatedAt": "2024-09-05T08:15:45.678Z"},
        {"id": "proj5", "name": "Social Media Strategy", "updatedAt": "2024-03-20T10:11:12.345Z"},
        {"id": "proj6", "name": "Client Onboarding", "updatedAt": "2024-02-28T16:33:22.456Z"},
        {"id": "proj7", "name": "Sales Pipeline Management", "updatedAt": "2024-04-12T19:40:11.567Z"},
        {"id": "proj8", "name": "Employee Training Program", "updatedAt": "2024-05-23T22:59:30.123Z"},
        {"id": "proj9", "name": "Financial Planning and Budgeting", "updatedAt": "2024-01-17T07:08:09.678Z"},
        {"id": "proj10", "name": "Content Creation and Blogging", "updatedAt": "2024-02-14T15:42:37.456Z"},
        {"id": "proj11", "name": "SEO Improvements", "updatedAt": "2024-03-01T12:00:00.123Z"},
        {"id": "proj12", "name": "Customer Feedback and Support", "updatedAt": "2024-04-18T14:30:45.789Z"},
        {"id": "proj13", "name": "Product Feature Development", "updatedAt": "2024-05-05T17:20:31.987Z"},
        {"id": "proj14", "name": "Internal Communication Tools", "updatedAt": "2024-06-25T09:55:44.210Z"},
        {"id": "proj15", "name": "Inventory Management", "updatedAt": "2024-07-11T03:23:54.321Z"},
        {"id": "proj16", "name": "Event Planning and Coordination", "updatedAt": "2024-08-19T13:37:22.876Z"},
        {"id": "proj17", "name": "Business Growth Strategies", "updatedAt": "2024-09-07T11:45:33.654Z"},
        {"id": "proj18", "name": "New Product Launch", "updatedAt": "2024-09-10T08:20:14.987Z"},
        {"id": "proj19", "name": "Legal and Compliance", "updatedAt": "2024-03-13T10:05:27.456Z"},
        {"id": "proj20", "name": "Performance Tracking and Reporting", "updatedAt": "2024-06-01T14:23:45.678Z"}
      ]
    }
  }
}

Writing Data

This is an example of how to create a new record in Blue using the Blue API.

curl -X POST https://api.blue.cc/graphql \
  -H "Content-Type: application/json" \
  -H "X-Bloo-Token-ID: YOUR_TOKEN_ID" \
  -H "X-Bloo-Token-Secret: YOUR_TOKEN_SECRET" \
  -H "X-Bloo-Company-ID: YOUR_COMPANY_ID" \
  --data-raw '{
    "query": "mutation CreateRecord { createTodo(input: { todoListId: \"TODOLISTID\", title: \"Test\", position: 65535 }) { id title position } }"
  }'

And here is an example of how to delete a record in Blue using the Blue API.

curl -X POST https://api.blue.cc/graphql \
  -H "Content-Type: application/json" \
  -H "X-Bloo-Token-ID: YOUR_TOKEN_ID" \
  -H "X-Bloo-Token-Secret: YOUR_TOKEN_SECRET" \
  -H "X-Bloo-Company-ID: YOUR_COMPANY_ID" \
  --data-raw '{
    "query": "mutation DeleteARecord { deleteTodo(input: { todoId: \"ENTER_RECORD_ID\" }) { success } }"
  }'

Subscriptions

With GraphQL subscriptions, you can receive real-time updates when data changes. This is useful for scenarios such as live chat, notifications, or when you want to ensure your local data is synchronized with the server.

To set up subscriptions, you need to initialize a WebSocket connection and send a subscription request to the server. The server will then push updates to the client whenever the data changes.

Here's an example of how to set up a subscription using a WebSocket connection in JavaScript:

Javascript example of subscription
const ws = new WebSocket('wss://api.blue.cc/graphql');

ws.onopen = () => {
  console.log('WebSocket connection opened');

  // Send subscription request
  ws.send(JSON.stringify({
    type: 'start',
    payload: {
      query: 'subscription { projectUpdated { id, name, updatedAt } }'
    }
  }));
};

ws.onmessage = (event) => { 
    const data = JSON.parse(event.data);
    console.log('Received data:', data);
};

ws.onclose = () => {
    console.log('WebSocket connection closed');
};

In this example, we first establish a WebSocket connection to the Blue API. Once the connection is open, we send a subscription request to the server. The server will then push updates to the client whenever the data changes.

The projectUpdated subscription will send the updated data to the client whenever the project is updated.