Skip to main content
API Clients are machine users that can interact with the Confidence APIs. Confidence has APIs for managing API clients programmatically.

Create an API Client

To create an API client you need to specify the name and desired permissions. You can either specify each permission separately or specify a role. In this example, you create an API client for managing flags. Give it a Flag editor role.
curl -X POST "https://api.confidence.dev/v1/apiClients" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "My API Client",
    "description": "Client for setting up flags in GHE repos",
    "permissions": [],
    "roles": [
      "roles/726f6c5f68386b6c46596c4a335350384e6a7377"
    ]
  }'
Response:
{
  "name": "apiClients/donlangsbyz6iiksdt4c",
  "displayName": "My API Client",
  "description": "Client for setting up flags in GHE repos",
  "clientId": "k9KkmxZfQtG6ZPqk9wyQfe7G5EzZsjza",
  "clientSecret": "4wvbCSdF7wlTdn8HJEqSkcuSqyndjwcHzQ3KEwxRcqvkfLeEG4eFapHQUIrRuDxr",
  "permissions": [],
  "roles": [
    "roles/726f6c5f68386b6c46596c4a335350384e6a7377"
  ],
  "createdBy": "users/xa8cecs2cc9xsz8jvgmc",
  "updatedBy": "users/xa8cecs2cc9xsz8jvgmc",
  "labels": {},
  "createTime": "2023-08-29T09:36:57.163017Z",
  "updateTime": "2023-08-29T09:36:57.163017Z"
}

Get an API Client

You can get an API client by passing the name of the client to the following endpoint.
curl -X GET "https://api.confidence.dev/v1/apiClients/donlangsbyz6iiksdt4c" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "name": "apiClients/donlangsbyz6iiksdt4c",
  "displayName": "My API Client",
  "description": "Client for setting up flags in GHE repos",
  "clientId": "k9KkmxZfQtG6ZPqk9wyQfe7G5EzZsjza",
  "clientSecret": "4wvbCSdF7wlTdn8HJEqSkcuSqyndjwcHzQ3KEwxRcqvkfLeEG4eFapHQUIrRuDxr",
  "permissions": [],
  "roles": [
    "roles/726f6c5f68386b6c46596c4a335350384e6a7377"
  ],
  "createdBy": "users/xa8cecs2cc9xsz8jvgmc",
  "updatedBy": "users/xa8cecs2cc9xsz8jvgmc",
  "labels": {},
  "createTime": "2023-08-29T09:36:57.163017Z",
  "updateTime": "2023-08-29T09:36:57.163017Z"
}

List API Clients

You can list all API clients in the organization using the following endpoint.
curl -X GET "https://api.confidence.dev/v1/apiClients" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "apiClients": [
    {
      "name": "apiClients/donlangsbyz6iiksdt4c",
      "displayName": "My API Client",
      "description": "Client for setting up flags in GHE repos",
      "clientId": "k9KkmxZfQtG6ZPqk9wyQfe7G5EzZsjza",
      "clientSecret": "4wvbCSdF7wlTdn8HJEqSkcuSqyndjwcHzQ3KEwxRcqvkfLeEG4eFapHQUIrRuDxr",
      "permissions": [],
      "roles": [
        "roles/726f6c5f68386b6c46596c4a335350384e6a7377"
      ],
      "createdBy": "users/xa8cecs2cc9xsz8jvgmc",
      "updatedBy": "users/xa8cecs2cc9xsz8jvgmc",
      "labels": {},
      "createTime": "2023-08-29T09:36:57.163017Z",
      "updateTime": "2023-08-29T09:36:57.163017Z"
    }
  ],
  "nextPageToken": ""
}