---
title: Update Okta account
description: Update an Okta account.
breadcrumbs: Docs > API > Update Okta account
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Update Okta account

## v2 (latest)

| Datadog site      | API endpoint                                                                       |
| ----------------- | ---------------------------------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/integrations/okta/accounts/{account_id}     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/integrations/okta/accounts/{account_id} |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/integrations/okta/accounts/{account_id} |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/integrations/okta/accounts/{account_id}      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/integrations/okta/accounts/{account_id} |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/integrations/okta/accounts/{account_id} |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/integrations/okta/accounts/{account_id} |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/integrations/okta/accounts/{account_id}      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/integrations/okta/accounts/{account_id}  |

### Overview

Update an Okta account.

This endpoint requires the `manage_integrations` permission.

### Arguments

#### Path Parameters

| Field                   | Type   | Description |
| ----------------------- | ------ | ----------- |
| account_id [*required*] | string | None        |

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                    | Type   | Description                                                                                       |
| ------------ | ------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
|              | data [*required*]        | object | Data object for updating an Okta account.                                                         |
| data         | attributes               | object | Attributes object for updating an Okta account.                                                   |
| attributes   | api_key                  | string | The API key of the Okta account.                                                                  |
| attributes   | auth_method [*required*] | string | The authorization method for an Okta account.                                                     |
| attributes   | client_id                | string | The Client ID of an Okta app integration.                                                         |
| attributes   | client_secret            | string | The client secret of an Okta app integration.                                                     |
| attributes   | domain [*required*]      | string | The domain associated with an Okta account.                                                       |
| data         | type                     | enum   | Account type for an Okta account. Allowed enum values: `okta-accounts`. Default: `okta-accounts`. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "auth_method": "oauth",
      "domain": "https://example.okta.com/",
      "client_id": "client_id",
      "client_secret": "client_secret"
    },
    "type": "okta-accounts"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response object for an Okta account.

| Parent field | Field                    | Type   | Description                                                                                       |
| ------------ | ------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
|              | data                     | object | Schema for an Okta account.                                                                       |
| data         | attributes [*required*]  | object | Attributes object for an Okta account.                                                            |
| attributes   | auth_method [*required*] | string | The authorization method for an Okta account.                                                     |
| attributes   | client_id                | string | The Client ID of an Okta app integration.                                                         |
| attributes   | domain [*required*]      | string | The domain of the Okta account.                                                                   |
| attributes   | name [*required*]        | string | The name of the Okta account.                                                                     |
| data         | id                       | string | The ID of the Okta account, a UUID hash of the account name.                                      |
| data         | type [*required*]        | enum   | Account type for an Okta account. Allowed enum values: `okta-accounts`. Default: `okta-accounts`. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "auth_method": "oauth",
      "client_id": "string",
      "domain": "https://example.okta.com/",
      "name": "Okta-Prod"
    },
    "id": "f749daaf-682e-4208-a38d-c9b43162c609",
    "type": "okta-accounts"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export account_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/integrations/okta/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "auth_method": "oauth",
      "domain": "https://example.okta.com/",
      "client_id": "client_id",
      "client_secret": "client_secret"
    },
    "type": "okta-accounts"
  }
}
EOF
```
{% /tab %}

{% tab label="Go" %}
```go
// Update Okta account returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "okta_account" in the system
	OktaAccountDataID := os.Getenv("OKTA_ACCOUNT_DATA_ID")

	body := datadogV2.OktaAccountUpdateRequest{
		Data: datadogV2.OktaAccountUpdateRequestData{
			Attributes: &datadogV2.OktaAccountUpdateRequestAttributes{
				AuthMethod:   "oauth",
				Domain:       "https://example.okta.com/",
				ClientId:     datadog.PtrString("client_id"),
				ClientSecret: datadog.PtrString("client_secret"),
			},
			Type: datadogV2.OKTAACCOUNTTYPE_OKTA_ACCOUNTS.Ptr(),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOktaIntegrationApi(apiClient)
	resp, r, err := api.UpdateOktaAccount(ctx, OktaAccountDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OktaIntegrationApi.UpdateOktaAccount`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OktaIntegrationApi.UpdateOktaAccount`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Update Okta account returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OktaIntegrationApi;
import com.datadog.api.client.v2.model.OktaAccountResponse;
import com.datadog.api.client.v2.model.OktaAccountType;
import com.datadog.api.client.v2.model.OktaAccountUpdateRequest;
import com.datadog.api.client.v2.model.OktaAccountUpdateRequestAttributes;
import com.datadog.api.client.v2.model.OktaAccountUpdateRequestData;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    OktaIntegrationApi apiInstance = new OktaIntegrationApi(defaultClient);

    // there is a valid "okta_account" in the system
    String OKTA_ACCOUNT_DATA_ID = System.getenv("OKTA_ACCOUNT_DATA_ID");

    OktaAccountUpdateRequest body =
        new OktaAccountUpdateRequest()
            .data(
                new OktaAccountUpdateRequestData()
                    .attributes(
                        new OktaAccountUpdateRequestAttributes()
                            .authMethod("oauth")
                            .domain("https://example.okta.com/")
                            .clientId("client_id")
                            .clientSecret("client_secret"))
                    .type(OktaAccountType.OKTA_ACCOUNTS));

    try {
      OktaAccountResponse result = apiInstance.updateOktaAccount(OKTA_ACCOUNT_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OktaIntegrationApi#updateOktaAccount");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Update Okta account returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi
from datadog_api_client.v2.model.okta_account_type import OktaAccountType
from datadog_api_client.v2.model.okta_account_update_request import OktaAccountUpdateRequest
from datadog_api_client.v2.model.okta_account_update_request_attributes import OktaAccountUpdateRequestAttributes
from datadog_api_client.v2.model.okta_account_update_request_data import OktaAccountUpdateRequestData

# there is a valid "okta_account" in the system
OKTA_ACCOUNT_DATA_ID = environ["OKTA_ACCOUNT_DATA_ID"]

body = OktaAccountUpdateRequest(
    data=OktaAccountUpdateRequestData(
        attributes=OktaAccountUpdateRequestAttributes(
            auth_method="oauth",
            domain="https://example.okta.com/",
            client_id="client_id",
            client_secret="client_secret",
        ),
        type=OktaAccountType.OKTA_ACCOUNTS,
    ),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = OktaIntegrationApi(api_client)
    response = api_instance.update_okta_account(account_id=OKTA_ACCOUNT_DATA_ID, body=body)

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Update Okta account returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::OktaIntegrationAPI.new

# there is a valid "okta_account" in the system
OKTA_ACCOUNT_DATA_ID = ENV["OKTA_ACCOUNT_DATA_ID"]

body = DatadogAPIClient::V2::OktaAccountUpdateRequest.new({
  data: DatadogAPIClient::V2::OktaAccountUpdateRequestData.new({
    attributes: DatadogAPIClient::V2::OktaAccountUpdateRequestAttributes.new({
      auth_method: "oauth",
      domain: "https://example.okta.com/",
      client_id: "client_id",
      client_secret: "client_secret",
    }),
    type: DatadogAPIClient::V2::OktaAccountType::OKTA_ACCOUNTS,
  }),
})
p api_instance.update_okta_account(OKTA_ACCOUNT_DATA_ID, body)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Update Okta account returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_okta_integration::OktaIntegrationAPI;
use datadog_api_client::datadogV2::model::OktaAccountType;
use datadog_api_client::datadogV2::model::OktaAccountUpdateRequest;
use datadog_api_client::datadogV2::model::OktaAccountUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::OktaAccountUpdateRequestData;

#[tokio::main]
async fn main() {
    // there is a valid "okta_account" in the system
    let okta_account_data_id = std::env::var("OKTA_ACCOUNT_DATA_ID").unwrap();
    let body = OktaAccountUpdateRequest::new(
        OktaAccountUpdateRequestData::new()
            .attributes(
                OktaAccountUpdateRequestAttributes::new(
                    "oauth".to_string(),
                    "https://example.okta.com/".to_string(),
                )
                .client_id("client_id".to_string())
                .client_secret("client_secret".to_string()),
            )
            .type_(OktaAccountType::OKTA_ACCOUNTS),
    );
    let configuration = datadog::Configuration::new();
    let api = OktaIntegrationAPI::with_config(configuration);
    let resp = api
        .update_okta_account(okta_account_data_id.clone(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Update Okta account returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v2.OktaIntegrationApi(configuration);

// there is a valid "okta_account" in the system
const OKTA_ACCOUNT_DATA_ID = process.env.OKTA_ACCOUNT_DATA_ID as string;

const params: v2.OktaIntegrationApiUpdateOktaAccountRequest = {
  body: {
    data: {
      attributes: {
        authMethod: "oauth",
        domain: "https://example.okta.com/",
        clientId: "client_id",
        clientSecret: "client_secret",
      },
      type: "okta-accounts",
    },
  },
  accountId: OKTA_ACCOUNT_DATA_ID,
};

apiInstance
  .updateOktaAccount(params)
  .then((data: v2.OktaAccountResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
