[API] Deploy certificates on Android hosts - #35156
Conversation
Added a section for adding certificates in the REST API documentation.
| ### Add certificate | ||
|
|
||
| Add certificate to deploy to the all hosts on the team. Fleet currently supports adding certificates for Android that are issued from custom [SCEP](https://en.wikipedia.org/wiki/Simple_Certificate_Enrollment_Protocol) certificate authority. | ||
|
|
||
| `POST /api/v1/fleet/certificates` | ||
|
|
||
| #### Parameters | ||
|
|
||
| | Name | Type | In | Description | | ||
| | -------- | ------- | ---- | ------------------------------------------- | | ||
| | name | string | body | **Required.** The name of the certificate. Name can be used as certificate alias to reference in configuration profiles. | | ||
| | team | string | query | _Available in Fleet Premium_. The team ID to add profiles to. | | ||
| | certificate_authority_id | integer | body | **Required.** The certificate authority (CA) ID to issue certificate from. Currently, only custom SCEP CA is supported. To get ID use [List certificate authorities](#list-certificate-authorities-cas). | | ||
| | subject_name | string | body |**Required** The certificate's subject name (SN). Separate subject fields by a "/". For example: "/CN=john@example.com/O=Acme Inc.". | |
There was a problem hiding this comment.
This is an end-user endpoint, but the parent ticket is exclusively targeting GitOps. I think we need a /spec endpoint in the contributor API that we can use to upload multiple certificates at once, like the "apply labels" endpoint:
fleet/docs/Contributing/reference/api-for-contributors.md
Lines 2144 to 2183 in 86b80e2
| ### List certificates | ||
|
|
||
| List certificate added to Fleet with [Add certificate](#add-certificate). | ||
|
|
||
| `GET /api/v1/fleet/certificates` | ||
|
|
||
| #### Parameters | ||
|
|
||
| | Name | Type | In | Description | | ||
| | ----------| ------- | ---- | -------------------------------------------------------------- | | ||
| | team | string | query | _Available in Fleet Premium_. The team ID to filter profiles. | | ||
| | page | integer | query | Page number of the results to fetch. | | ||
| | per_page | integer | query | Results per page. | | ||
|
|
||
| #### Example | ||
|
|
||
| `GET /api/v1/fleet/certificates` | ||
|
|
||
| ##### Default response | ||
|
|
||
| `Status: 200` | ||
|
|
||
| ```json | ||
| { | ||
| "certificates": [ | ||
| { | ||
| "id": 1, | ||
| "name": "wifi-certificate", | ||
| "certificate_authority_id": "1", | ||
| "certificate_authority_name": "PRODUCTION_SCEP_SERVER", | ||
| "created_at": "2025-11-04T00:00:00Z", | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "name": "vpn-certificate", | ||
| "certificate_authority_id": "1", | ||
| "certificate_authority_name": "PRODUCTION_SCEP_SERVER", | ||
| "created_at": "2025-11-04T00:00:00Z", | ||
| } | ||
| ], | ||
| "meta": { | ||
| "has_next_results": false, | ||
| "has_previous_results": false | ||
| } | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Is this used anywhere in #35198? If not can we cut if for scope?
There was a problem hiding this comment.
Actually we probably need something like this for GitOps, but more likely another /spec endpoint.
| "created_at": "2025-11-04T00:00:00Z", | ||
| "id": 1, | ||
| "name": "wifi-certificate", | ||
| "subject_name": "/CN=$FLEET_VAR_HOST_END_USER_IDP_USERNAME/OU=$FLEET_VAR_HOST_UUID/ST=$FLEET_VAR_HOST_HARDWARE_SERIAL", |
There was a problem hiding this comment.
If host_uuid is included in the request, the $FLEET_VAR_* tokens should be replaced with actual values from the host.
|
Just to be specific, here are the ends points I made as in #35788 |
|
|
||
| ### Add certificate | ||
|
|
||
| Add certificate to deploy to the all hosts on the team. Fleet currently supports adding certificates for Android that are issued from custom [SCEP](https://en.wikipedia.org/wiki/Simple_Certificate_Enrollment_Protocol) certificate authority. |
There was a problem hiding this comment.
| Add certificate to deploy to the all hosts on the team. Fleet currently supports adding certificates for Android that are issued from custom [SCEP](https://en.wikipedia.org/wiki/Simple_Certificate_Enrollment_Protocol) certificate authority. | |
| Add certificate to deploy to a host. Fleet currently supports adding certificates for Android that are issued from custom [SCEP](https://en.wikipedia.org/wiki/Simple_Certificate_Enrollment_Protocol) certificate authority. |
Related to: