Skip to content

Commit 24c2471

Browse files
Serverless admin user and API-only key workflow improvements (#7277)
Clarifies the confusion around the built-in `admin` user returned when creating Serverless projects via the API (see elastic/docs-content-internal#546). --------- Co-authored-by: wajihaparvez <wajiha.parvez@elastic.co>
1 parent 0167034 commit 24c2471

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

deploy-manage/deploy/elastic-cloud/manage-serverless-projects-using-api.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ navigation_title: Manage projects with API
88

99
# Manage serverless projects using the API [serverless-api]
1010

11-
On this page, you can find examples of how to create and manage serverless projects using the [Elastic Cloud Serverless API]({{cloud-serverless-apis}}), covering common operations such as:
11+
On this page, you can find examples of how to create and manage serverless projects using the [{{serverless-full}} API]({{cloud-serverless-apis}}), covering common operations such as:
1212

1313
- [Creating a project](#general-manage-project-with-api-create-a-serverless-elasticsearch-project)
1414
- [Retrieving project details](#general-manage-project-with-api-get-project)
1515
- [Retrieving the project's status](#general-manage-project-with-api-get-project-status)
16-
- [Resetting credentials](#general-manage-project-with-api-reset-credentials)
1716
- [Deleting a project](#general-manage-project-with-api-delete-project)
1817
- [Updating a project](#general-manage-project-with-api-update-project)
1918
- [Listing regions where projects can be created](#general-manage-project-with-api-list-available-regions)
@@ -26,7 +25,7 @@ To try the examples in this section, start by [setting up an API key](#general-m
2625

2726
## API resources
2827

29-
To learn about API principles, authentication, and how to use the OpenAPI specification, refer to the [Elastic Cloud Serverless API]({{cloud-serverless-apis}}) documentation.
28+
To learn about API principles, authentication, and how to use the OpenAPI specification, refer to the [{{serverless-full}} API]({{cloud-serverless-apis}}) documentation.
3029

3130
The available APIs are grouped by project type:
3231

@@ -36,12 +35,20 @@ The available APIs are grouped by project type:
3635

3736
## Set up an API key [general-manage-project-with-api-set-up-api-key]
3837

39-
1. [Create an API key](https://www.elastic.co/docs/deploy-manage/api-keys/elastic-cloud-api-keys).
38+
To create and manage projects with the {{serverless-full}} API, you must authenticate your requests with an {{ecloud}} API key.
39+
40+
1. As an **Organization owner**, [create an {{ecloud}} API key](/deploy-manage/api-keys/elastic-cloud-api-keys.md) with one of the following roles:
41+
42+
- **Organization owner**
43+
- **Cloud resource access** with the **Admin** role assigned to **all projects** of the relevant type ({{es}}, {{observability}}, or Security)
44+
45+
Select the key's **API access** level based on what you need it to do: **Cloud API** access is enough to manage projects, while **Cloud, {{es}}, and {{kib}} API** access also grants access to the project's {{es}} and {{kib}} endpoints. For more details, refer to [User roles and privileges](/deploy-manage/users-roles/cloud-organization/user-roles.md).
46+
4047
2. Store the generated API key as an environment variable so that you don’t need to specify it again for each request:
4148

42-
```console
43-
export API_KEY="YOUR_GENERATED_API_KEY"
44-
```
49+
```console
50+
export API_KEY="YOUR_GENERATED_API_KEY"
51+
```
4552

4653
## Create an {{serverless-full}} project [general-manage-project-with-api-create-a-serverless-elasticsearch-project]
4754

@@ -61,7 +68,7 @@ curl -H "Authorization: ApiKey $API_KEY" \
6168
1. Replace `My project` with a more descriptive name in this call.
6269
2. You can obtain a [list of available regions](#general-manage-project-with-api-list-available-regions).
6370

64-
The response from the create project request will include the created project details, such as the project ID, the credentials to access the project, and the endpoints to access different apps such as {{es}} and {{kib}}.
71+
The response from the create project request will include the created project details, including the project ID, the endpoints to access different apps such as {{es}} and {{kib}}, and a set of default credentials.
6572

6673
Example of `Create project` response:
6774

@@ -80,6 +87,12 @@ Example of `Create project` response:
8087
}
8188
```
8289

90+
:::{note}
91+
For programmatic access to the project's {{es}} and {{kib}} APIs, we recommend creating an [{{ecloud}} API key with access to the {{es}} and {{kib}} APIs](/deploy-manage/api-keys/elastic-cloud-api-keys.md#project-access) rather than using the default credentials.
92+
93+
The default credentials returned in the `credentials` field serve as a fallback mechanism to access the project when no API key is available. Store them in a secure location, and use the [reset credentials API]({{cloud-serverless-apis}}operation/operation-resetelasticsearchprojectcredentials) if you need to recover or rotate them.
94+
:::
95+
8396
You can store the project ID as an environment variable for the next requests:
8497

8598
```console
@@ -112,16 +125,6 @@ Example response:
112125
}
113126
```
114127

115-
## Reset credentials [general-manage-project-with-api-reset-credentials]
116-
117-
If you lose the credentials provided at the time of the project creation, you can reset the credentials by using the following endpoint:
118-
119-
```bash
120-
curl -H "Authorization: ApiKey $API_KEY" \
121-
-XPOST \
122-
"https://api.elastic-cloud.com/api/v1/serverless/projects/elasticsearch/${PROJECT_ID}/_reset-credentials"
123-
```
124-
125128
## Delete a project [general-manage-project-with-api-delete-project]
126129

127130
You can delete your project via the API:

0 commit comments

Comments
 (0)