# Blues Notehub

## Get device environment variables from Blues Notehub

> Retrieves environment variables for a Blues Notehub device. This endpoint proxies the request to the Blues Notehub API using your organization's stored Notehub PAT credential.\
> \
> \*\*Prerequisites:\*\*\
> \- Device must be a Blues Notehub device (source\_type: "notehub")\
> \- Organization must have a Notehub PAT credential configured in External Credentials\
> \- API key must have "read" scope permission\
> \
> \*\*How it works:\*\*\
> 1\. Validates your Qubitro API key and extracts your organization\
> 2\. Looks up the Notehub PAT credential stored in your organization's external credentials\
> 3\. Fetches the device to get its Notehub device UID\
> 4\. Proxies the request to Blues Notehub API\
> 5\. Returns the environment variables from Notehub

```json
{"openapi":"3.0.0","info":{"title":"Qubitro Public API","version":"2.0"},"servers":[{"url":"https://api.qubitro.com"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Enter your API key with the Bearer prefix, e.g. \"Bearer QB_your_api_key_here\"","type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"blues.environmentVariablesResponseBody":{"type":"object","properties":{"environment_variables":{"description":"Key-value pairs of environment variables","type":"object","additionalProperties":{"type":"string"}}}},"main.ErrorResponse":{"type":"object","properties":{"action":{"description":"Action that was attempted","type":"string"},"code":{"description":"Optional error code","type":"string"},"details":{"description":"Optional additional details","type":"string"},"message":{"description":"Human-readable error message","type":"string"},"success":{"description":"Operation failed","type":"boolean"}}}}},"paths":{"/v2/projects/{project_id}/devices/{device_id}/blues/environment-variables":{"get":{"description":"Retrieves environment variables for a Blues Notehub device. This endpoint proxies the request to the Blues Notehub API using your organization's stored Notehub PAT credential.\n\n**Prerequisites:**\n- Device must be a Blues Notehub device (source_type: \"notehub\")\n- Organization must have a Notehub PAT credential configured in External Credentials\n- API key must have \"read\" scope permission\n\n**How it works:**\n1. Validates your Qubitro API key and extracts your organization\n2. Looks up the Notehub PAT credential stored in your organization's external credentials\n3. Fetches the device to get its Notehub device UID\n4. Proxies the request to Blues Notehub API\n5. Returns the environment variables from Notehub","tags":["Blues Notehub"],"summary":"Get device environment variables from Blues Notehub","parameters":[{"description":"Project ID (UUID format)","name":"project_id","in":"path","required":true,"schema":{"type":"string"}},{"description":"Device ID (UUID format)","name":"device_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Environment variables retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/blues.environmentVariablesResponseBody"}}}},"400":{"description":"Device is not a Blues Notehub device","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"404":{"description":"Device not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"424":{"description":"Notehub PAT credential not configured for this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"502":{"description":"Blues Notehub API returned an error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}}}}}}}
```

## Set device environment variables in Blues Notehub

> Sets environment variables for a Blues Notehub device. This endpoint proxies the request to the Blues Notehub API using your organization's stored Notehub PAT credential.\
> \
> \*\*Prerequisites:\*\*\
> \- Device must be a Blues Notehub device (source\_type: "notehub")\
> \- Organization must have a Notehub PAT credential configured in External Credentials\
> \- API key must have "update" scope permission\
> \- Notehub PAT must have at least "developer" role permissions\
> \
> \*\*How it works:\*\*\
> 1\. Validates your Qubitro API key and extracts your organization\
> 2\. Looks up the Notehub PAT credential stored in your organization's external credentials\
> 3\. Fetches the device to get its Notehub device UID\
> 4\. Proxies the request to Blues Notehub API to set the environment variables\
> 5\. Returns success if the variables were set\
> \
> \*\*Note:\*\* Environment variables set via this endpoint will be synchronized to the Notecard device on its next sync with Notehub.

```json
{"openapi":"3.0.0","info":{"title":"Qubitro Public API","version":"2.0"},"servers":[{"url":"https://api.qubitro.com"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Enter your API key with the Bearer prefix, e.g. \"Bearer QB_your_api_key_here\"","type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"blues.setEnvironmentVariablesRequestBody":{"type":"object","properties":{"environment_variables":{"description":"Key-value pairs of environment variables to set","type":"object","additionalProperties":{"type":"string"}}}},"main.SuccessResponse":{"type":"object","properties":{"action":{"description":"Action that was performed","type":"string"},"message":{"description":"Human-readable success message","type":"string"},"success":{"description":"Operation completed successfully","type":"boolean"}}},"main.ErrorResponse":{"type":"object","properties":{"action":{"description":"Action that was attempted","type":"string"},"code":{"description":"Optional error code","type":"string"},"details":{"description":"Optional additional details","type":"string"},"message":{"description":"Human-readable error message","type":"string"},"success":{"description":"Operation failed","type":"boolean"}}}}},"paths":{"/v2/projects/{project_id}/devices/{device_id}/blues/environment-variables":{"put":{"description":"Sets environment variables for a Blues Notehub device. This endpoint proxies the request to the Blues Notehub API using your organization's stored Notehub PAT credential.\n\n**Prerequisites:**\n- Device must be a Blues Notehub device (source_type: \"notehub\")\n- Organization must have a Notehub PAT credential configured in External Credentials\n- API key must have \"update\" scope permission\n- Notehub PAT must have at least \"developer\" role permissions\n\n**How it works:**\n1. Validates your Qubitro API key and extracts your organization\n2. Looks up the Notehub PAT credential stored in your organization's external credentials\n3. Fetches the device to get its Notehub device UID\n4. Proxies the request to Blues Notehub API to set the environment variables\n5. Returns success if the variables were set\n\n**Note:** Environment variables set via this endpoint will be synchronized to the Notecard device on its next sync with Notehub.","tags":["Blues Notehub"],"summary":"Set device environment variables in Blues Notehub","parameters":[{"description":"Project ID (UUID format)","name":"project_id","in":"path","required":true,"schema":{"type":"string"}},{"description":"Device ID (UUID format)","name":"device_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/blues.setEnvironmentVariablesRequestBody"}}},"description":"Environment variables to set","required":true},"responses":{"200":{"description":"Environment variables set successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.SuccessResponse"}}}},"400":{"description":"Invalid request body or device is not a Blues Notehub device","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"404":{"description":"Device not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"424":{"description":"Notehub PAT credential not configured for this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}},"502":{"description":"Blues Notehub API returned an error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/main.ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qubitro.com/developers/blues-notehub.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
