Devices
Devices represent individual installations of your app that are managed by Capgo. The Devices API allows you to track and manage devices, including their versions, channels, and update status.
Understanding Devices
Section titled âUnderstanding DevicesâEach device has unique characteristics and states:
- Platform: iOS or Android
- Version: Current bundle version and native build version
- Environment: Production or development, emulator or physical device
- Channel: Current update channel assignment
- Custom ID: Optional identifier for your own tracking purposes
Best Practices
Section titled âBest Practicesâ- Version Tracking: Monitor device versions to ensure update adoption
- Channel Management: Assign devices to appropriate channels based on testing needs
- Environment Awareness: Handle different environments (prod/dev/emulator) appropriately
- Custom Identification: Use custom IDs to integrate with your existing systems
Endpoints
Section titled âEndpointsâhttps://api.capgo.app/device/
Link a device to a specific version or channel.
Request Body
Section titled âRequest Bodyâinterface DeviceLink { app_id: string device_id: string version_id?: string // version name channel?: string // channel name}Example Request
Section titled âExample Requestâcurl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "app_123", "device_id": "device_456", "channel": "beta" }' \ https://api.capgo.app/device/Success Response
Section titled âSuccess Responseâ{ "status": "ok"}https://api.capgo.app/device/
Retrieve device information. Uses cursor-based pagination for efficient retrieval of large device lists.
Query Parameters
Section titled âQuery Parametersâapp_id: Required. The ID of your appdevice_id: Optional. Specific device ID to retrieve a single devicecursor: Optional. Cursor from previous response for paginationlimit: Optional. Number of devices per page (default: 50)
Example Requests
Section titled âExample Requestsâ# Get all devices (first page)curl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=app_123"
# Get specific devicecurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=app_123&device_id=device_456"
# Get next page using cursorcurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=app_123&cursor=2024-01-01T00:00:00Z|device_456"Response Type (List)
Section titled âResponse Type (List)âWhen requesting multiple devices (no device_id parameter):
interface DeviceListResponse { data: Device[]; nextCursor?: string; // Pass this as 'cursor' param to get next page hasMore: boolean; // true if more pages available}
interface Device { updated_at: string; device_id: string; custom_id: string; version?: number; version_name: string | null; channel?: string; app_id: string; platform: "ios" | "android"; plugin_version: string; os_version: string; version_build: string; is_prod: boolean; is_emulator: boolean; key_id: string | null; // First 4 chars of encryption key (e.g., "MIIB")}Response Type (Single Device)
Section titled âResponse Type (Single Device)âWhen requesting a specific device with device_id parameter, returns the device object directly:
interface Device { updated_at: string; device_id: string; custom_id: string; version?: number; version_name: string | null; channel?: string; app_id: string; platform: "ios" | "android"; plugin_version: string; os_version: string; version_build: string; is_prod: boolean; is_emulator: boolean; key_id: string | null; // First 4 chars of encryption key (e.g., "MIIB")}Example Response (List)
Section titled âExample Response (List)â{ "data": [ { "device_id": "device_456", "custom_id": "test-device-1", "version": 1, "version_name": "1.0.0", "app_id": "app_123", "platform": "ios", "plugin_version": "5.0.0", "os_version": "17.0", "version_build": "1", "is_prod": true, "is_emulator": false, "updated_at": "2024-01-01T00:00:00Z" } ], "nextCursor": "2024-01-01T00:00:00Z|device_456", "hasMore": true}Example Response (Single Device)
Section titled âExample Response (Single Device)â{ "device_id": "device_456", "custom_id": "test-device-1", "version": 1, "version_name": "1.0.0", "app_id": "app_123", "platform": "ios", "plugin_version": "5.0.0", "os_version": "17.0", "version_build": "1", "is_prod": true, "is_emulator": false, "updated_at": "2024-01-01T00:00:00Z", "channel": "production"}https://api.capgo.app/device/
Unlink a device from its channel override. This resets the device to use its default channel.
Query Parameters
Section titled âQuery Parametersâinterface Device { device_id: string app_id: string}Example Request
Section titled âExample Requestâcurl -X DELETE \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "app_123", "device_id": "device_456" }' \ https://api.capgo.app/device/Success Response
Section titled âSuccess Responseâ{ "status": "ok"}Error Handling
Section titled âError HandlingâCommon error scenarios and their responses:
// Device not found{ "error": "Device not found", "status": "KO"}
// Invalid version{ "error": "Version not found", "status": "KO"}
// Invalid channel{ "error": "Channel not found", "status": "KO"}
// Permission denied{ "error": "Insufficient permissions to manage devices", "status": "KO"}Common Use Cases
Section titled âCommon Use Casesâ- Beta Device Registration
{ "app_id": "app_123", "device_id": "device_456", "channel": "beta"}- Version Override
{ "app_id": "app_123", "device_id": "device_456", "version_id": "1.1.0"}- Reset to Default Channel
// Use DELETE endpoint to remove overridesTips for Device Management
Section titled âTips for Device Managementâ- Monitoring: Regularly check device status and version distribution
- Testing: Use custom IDs to identify test devices easily
- Troubleshooting: Track device updates and channel assignments
- Version Control: Monitor native app versions to ensure compatibility