# Fleet

## Get all fleets of an organization by its HANDLE

> \## Fleet Resource Fields\
> \
> \| Field |\
> \| :--- |\
> \| \`id\` |\
> \| \`uuid\` |\
> \| \`organization\` |\
> \| \`actor\` |\
> \| \`app\_name\` |\
> \| \`slug\` |\
> \| \`should\_be\_running\_\_release\` |\
> \| \`application\_type\` |\
> \| \`is\_for\_\_device\_type\` |\
> \| \`should\_track\_latest\_release\` |\
> \| \`is\_accessible\_by\_support\_until\_\_date\` |\
> \| \`is\_public\` |\
> \| \`is\_host\` |\
> \| \`is\_archived\` |\
> \| \`is\_discoverable\` |\
> \| \`is\_stored\_at\_\_repository\_url\` |\
> \| \`created\_at\` |\
> \
> \
> \---\
> \
> \`GET /v7/application\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Get all fleets\
> \`GET /v7/application\`\
> \
> Note: This will also include all public fleets of the platform. In most cases retrieving the fleets by their organization will be preferable.\
> \
> \--- \
> \#### Get all fleets associated with authenticated user\
> \`GET /v7/application?$filter=is\_directly\_accessible\_by\_\_user/any(dau:true)\`\
> \
> \--- \
> \#### Get fleet by name\
> \`GET /v7/application?$filter=app\_name eq '\<NAME>'\`\
> \
> \--- \
> \#### Filter public fleets from result\
> \`GET /v7/application?$filter=is\_public eq false\`

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application":{"get":{"tags":["Fleet"],"summary":"Get all fleets of an organization by its HANDLE","description":"## Fleet Resource Fields\n\n| Field |\n| :--- |\n| `id` |\n| `uuid` |\n| `organization` |\n| `actor` |\n| `app_name` |\n| `slug` |\n| `should_be_running__release` |\n| `application_type` |\n| `is_for__device_type` |\n| `should_track_latest_release` |\n| `is_accessible_by_support_until__date` |\n| `is_public` |\n| `is_host` |\n| `is_archived` |\n| `is_discoverable` |\n| `is_stored_at__repository_url` |\n| `created_at` |\n\n\n---\n\n`GET /v7/application`\n\n\n### Usage Variations\n\n--- \n#### Get all fleets\n`GET /v7/application`\n\nNote: This will also include all public fleets of the platform. In most cases retrieving the fleets by their organization will be preferable.\n\n--- \n#### Get all fleets associated with authenticated user\n`GET /v7/application?$filter=is_directly_accessible_by__user/any(dau:true)`\n\n--- \n#### Get fleet by name\n`GET /v7/application?$filter=app_name eq '<NAME>'`\n\n--- \n#### Filter public fleets from result\n`GET /v7/application?$filter=is_public eq false`"}}}}
```

## Create fleet

> \`POST /v7/application\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "app\_name": \<NAME>,\
> &#x20;   "organization": \<ORGANIZATION\_ID>,\
> &#x20;   "is\_for\_\_device\_type": \<DEVICE\_TYPE\_ID>\
> }\
> \`\`\`\
> \
> To retrieve the numeric ORGANIZATION\_ID & DEVICE\_TYPE\_ID, check the respective documentation page for the organization & device type resources.

````json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application":{"post":{"tags":["Fleet"],"summary":"Create fleet","description":"`POST /v7/application`\n\n**Request Body:**\n```json\n{\n    \"app_name\": <NAME>,\n    \"organization\": <ORGANIZATION_ID>,\n    \"is_for__device_type\": <DEVICE_TYPE_ID>\n}\n```\n\nTo retrieve the numeric ORGANIZATION_ID & DEVICE_TYPE_ID, check the respective documentation page for the organization & device type resources.","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}
````

## Get fleet by ID

> \`GET /v7/application(\<ID>)\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Get fleet by id along with its devices\
> \`GET /v7/application(\<ID>)?$expand=owns\_\_device\`

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application({ID})":{"get":{"tags":["Fleet"],"summary":"Get fleet by ID","description":"`GET /v7/application(<ID>)`\n\n\n### Usage Variations\n\n--- \n#### Get fleet by id along with its devices\n`GET /v7/application(<ID>)?$expand=owns__device`","parameters":[{"name":"ID","in":"path","required":true}]}}}}
```

## Delete fleet

> \`DELETE /v7/application(\<ID>)\`

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application({ID})":{"delete":{"tags":["Fleet"],"summary":"Delete fleet","description":"`DELETE /v7/application(<ID>)`","parameters":[{"name":"ID","in":"path","required":true}]}}}}
```

## Pin entire fleet to a specific release by ID

> \`PATCH /v7/application(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "should\_be\_running\_\_release": \<RELEASE ID>,\
> &#x20;   "should\_track\_latest\_release": false\
> }\
> \`\`\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Disable automatic update tracking for a fleet\
> \`PATCH /v7/application(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "should\_track\_latest\_release": false\
> }\
> \`\`\`\
> \
> \--- \
> \#### Enable automatic update tracking for a fleet\
> \`PATCH /v7/application(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "should\_track\_latest\_release": true\
> }\
> \`\`\`

````json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application({ID})":{"patch":{"tags":["Fleet"],"summary":"Pin entire fleet to a specific release by ID","description":"`PATCH /v7/application(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"should_be_running__release\": <RELEASE ID>,\n    \"should_track_latest_release\": false\n}\n```\n\n\n### Usage Variations\n\n--- \n#### Disable automatic update tracking for a fleet\n`PATCH /v7/application(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"should_track_latest_release\": false\n}\n```\n\n--- \n#### Enable automatic update tracking for a fleet\n`PATCH /v7/application(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"should_track_latest_release\": true\n}\n```","parameters":[{"name":"ID","in":"path","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}
````

## Get fleet by SLUG

> \`GET /v7/application(slug='\<SLUG>')\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Get fleet by SLUG along with its devices\
> \`GET /v7/application(slug='\<SLUG>')?$expand=owns\_\_device\`\
> \
> \--- \
> \#### Get the target release of a fleet\
> \`GET /v7/application(slug='\<SLUG>')?$select=should\_be\_running\_\_release\`

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application(slug='{SLUG}')":{"get":{"tags":["Fleet"],"summary":"Get fleet by SLUG","description":"`GET /v7/application(slug='<SLUG>')`\n\n\n### Usage Variations\n\n--- \n#### Get fleet by SLUG along with its devices\n`GET /v7/application(slug='<SLUG>')?$expand=owns__device`\n\n--- \n#### Get the target release of a fleet\n`GET /v7/application(slug='<SLUG>')?$select=should_be_running__release`","parameters":[{"name":"SLUG","in":"path","required":true}]}}}}
```

## Pin entire fleet to a specific release by SLUG

> \`PATCH /v7/application(slug='\<SLUG>')\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "should\_be\_running\_\_release": \<RELEASE ID>,\
> &#x20;   "should\_track\_latest\_release": false\
> }\
> \`\`\`

````json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/application(slug='{SLUG}')":{"patch":{"tags":["Fleet"],"summary":"Pin entire fleet to a specific release by SLUG","description":"`PATCH /v7/application(slug='<SLUG>')`\n\n**Request Body:**\n```json\n{\n    \"should_be_running__release\": <RELEASE ID>,\n    \"should_track_latest_release\": false\n}\n```","parameters":[{"name":"SLUG","in":"path","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}
````
