import requests
url = "https://api.platform.ankra.app/org/clusters/managed/{provider}/import"
payload = {
"credential_id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee",
"provider_cluster_id": "regions/fr-par/clusters/11111111-2222-4333-8444-555555555555"
}
headers = {
"cookie": "ankra_session=",
"X-Ankra-CSRF": "<x-ankra-csrf>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
cookie: 'ankra_session=',
'X-Ankra-CSRF': '<x-ankra-csrf>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
credential_id: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee',
provider_cluster_id: 'regions/fr-par/clusters/11111111-2222-4333-8444-555555555555'
})
};
fetch('https://api.platform.ankra.app/org/clusters/managed/{provider}/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/clusters/managed/{provider}/import \
--header 'Content-Type: application/json' \
--header 'X-Ankra-CSRF: <x-ankra-csrf>' \
--cookie ankra_session= \
--data '
{
"credential_id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee",
"provider_cluster_id": "regions/fr-par/clusters/11111111-2222-4333-8444-555555555555"
}
'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"provenance": "created",
"provider_cluster_id": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}Import a managed cluster (browser session)
Browser session authentication; RBAC permission clusters.create. For Kapsule, provider_cluster_id is the opaque region-qualified regions/{region}/clusters/{id} reference. CNI is immutable. Imported/unknown provenance is disconnect-only; provider deletion is allowed by default only for created clusters. For ankracloud_k8s with no credential_id, the organisation’s built-in Ankra Cloud credential is used: the request answers 404 while the organisation’s ankra_cloud_provider feature flag is off, and 503 with Retry-After when the built-in credential cannot be created or renewed right now.
import requests
url = "https://api.platform.ankra.app/org/clusters/managed/{provider}/import"
payload = {
"credential_id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee",
"provider_cluster_id": "regions/fr-par/clusters/11111111-2222-4333-8444-555555555555"
}
headers = {
"cookie": "ankra_session=",
"X-Ankra-CSRF": "<x-ankra-csrf>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
cookie: 'ankra_session=',
'X-Ankra-CSRF': '<x-ankra-csrf>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
credential_id: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee',
provider_cluster_id: 'regions/fr-par/clusters/11111111-2222-4333-8444-555555555555'
})
};
fetch('https://api.platform.ankra.app/org/clusters/managed/{provider}/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/clusters/managed/{provider}/import \
--header 'Content-Type: application/json' \
--header 'X-Ankra-CSRF: <x-ankra-csrf>' \
--cookie ankra_session= \
--data '
{
"credential_id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee",
"provider_cluster_id": "regions/fr-par/clusters/11111111-2222-4333-8444-555555555555"
}
'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"provenance": "created",
"provider_cluster_id": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}Authorizations
Browser session. Mutations also require X-Ankra-CSRF.
Headers
Must match the ankra_csrf browser cookie.
Path Parameters
doks, uks, gke, ovh_mks, aks, eks, kapsule, ankracloud_k8s "kapsule"
Body
Required for every provider but ankracloud_k8s; the others answer 422 without it. For ankracloud_k8s it may be omitted when the built-in Ankra Cloud credential is configured: the organisation's built-in credential is then used.
production, staging, development, disposable 1 - 50