> ## Documentation Index
> Fetch the complete documentation index at: https://ona.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Regenerate SCIM Token

> Regenerates the bearer token for a SCIM configuration.

`Unary` · [`Organizations`](https://ona.com/docs/api-reference/generated/organization/overview)

Regenerates the bearer token for a SCIM configuration.

Use this method to:

* Rotate SCIM credentials
* Recover from token compromise
* Update IdP configuration

### Examples

* Regenerate token:

  Creates a new bearer token with the same expiration duration as the previous token.

  ```yaml theme={null}
  scimConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
  ```

* Regenerate token with new expiration:

  Creates a new bearer token with a custom 180-day expiration.

  ```yaml theme={null}
  scimConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
  tokenExpiresIn: "15552000s"
  ```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.OrganizationService/RegenerateSCIMToken
```

Send a Bearer token as described in [Authentication](https://ona.com/docs/api-reference.md#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

```bash cURL theme={null}
export ONA_HOST=https://app.ona.com
export ONA_API_KEY=<your-token>

curl --request POST \
  --url "$ONA_HOST/api/gitpod.v1.OrganizationService/RegenerateSCIMToken" \
  --header "Authorization: Bearer $ONA_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "scimConfigurationId": "<scim-configuration-id>"
}'
```

```python Python theme={null}
import gitpod.v1.organization_pb2 as organization_pb2
from ona_sdk import create_client_from_env

ona = create_client_from_env()
request = organization_pb2.RegenerateSCIMTokenRequest(
    scim_configuration_id="<scim-configuration-id>",
)
response = ona.services.organization.regenerate_scim_token(request)
print(response)
```

```typescript TypeScript theme={null}
import { create } from "@bufbuild/protobuf";
import { createClientFromEnv } from "@gitpod/sdk";
import { RegenerateSCIMTokenRequestSchema } from "@gitpod/sdk/gitpod/v1/organization_pb";

async function main() {
  const ona = createClientFromEnv();
  const request = create(RegenerateSCIMTokenRequestSchema, {
    scimConfigurationId: "<scim-configuration-id>",
  });
  const response = await ona.services.organization.regenerateSCIMToken(request);
  console.log(response);
}

main().catch(console.error);
```

```go Go theme={null}
package main

import (
	"context"
	"fmt"
	"log"

	"connectrpc.com/connect"
	"github.com/gitpod-io/gitpod-sdk-go/sdk"
	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
)

func main() {
	ona, err := sdk.NewFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	request := connect.NewRequest(&gitpodpb.RegenerateSCIMTokenRequest{
		ScimConfigurationId: "<scim-configuration-id>",
	})
	response, err := ona.Services.Organization.RegenerateSCIMToken(context.Background(), request)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(response.Msg)
}
```

```json Request body theme={null}
{
  "scimConfigurationId": "<scim-configuration-id>"
}
```

## Request

`gitpod.v1.RegenerateSCIMTokenRequest`

| Field | Type | Required | Description |
| - | - | - | - |
| `scimConfigurationId` | string | Yes | scim\_configuration\_id is the ID of the SCIM configuration to regenerate token for Constraints: `required=true, string.uuid=true`. |
| `tokenExpiresIn` | duration string | No | token\_expires\_in is the duration until the new token expires. If not specified, uses the same duration as the previous token. Constraints: `duration.gte.seconds=86400, duration.lte.seconds=63072000`. |

## Response

`gitpod.v1.RegenerateSCIMTokenResponse`

| Field | Type | Required | Description |
| - | - | - | - |
| `token` | string | Yes | token is the new bearer token for SCIM API authentication. This invalidates the previous token - store it securely. Constraints: `required=true`. |
| `tokenExpiresAt` | RFC 3339 timestamp | Yes | token\_expires\_at is when the new token will expire Constraints: `required=true`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.