---
title: Actualizar la tabla de referencia
description: Actualiza una tabla de referencia por ID.
breadcrumbs: Documentación > API > Actualizar la tabla de referencia
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/llms.txt).

# Actualizar la tabla de referencia

## v2 (latest)

| Datadog site      | API endpoint                                                            |
| ----------------- | ----------------------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/reference-tables/tables/{id}     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/reference-tables/tables/{id} |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/reference-tables/tables/{id} |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/reference-tables/tables/{id}      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/reference-tables/tables/{id} |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/reference-tables/tables/{id} |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/reference-tables/tables/{id} |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/reference-tables/tables/{id}      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/reference-tables/tables/{id}  |

### Overview

Actualiza una tabla de referencia por ID. Puedes actualizar los datos, la descripción y las etiquetas de la tabla. Nota: El tipo de fuente no puede modificarse tras la creación de la tabla. Para actualizar datos: para tablas existentes de tipo `source:LOCAL_FILE`, llama primero a POST api/v2/reference-tables/uploads para obtener un ID de carga, luego a PUT de partes de datos CSV a cada URL proporcionada, y finalmente llama a este endpoint PATCH con el upload_id en file_metadata. Para las tablas existentes con tipos `source:` de `S3`, `GCS`, o `AZURE`, proporciona access_details actualizados en file_metadata apuntando a un archivo CSV en el mismo tipo de almacenamiento en la nube.

### Arguments

#### Path Parameters

| Field           | Type   | Description                                        |
| --------------- | ------ | -------------------------------------------------- |
| id [*required*] | string | Unique identifier of the reference table to update |

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field   | Field                      | Type     | Description                                                                                                                                                                                     |
| -------------- | -------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                | data                       | object   | Cuerpo de la solicitud de actualización de una tabla de referencia existente.                                                                                                                   |
| data           | attributes                 | object   | Attributes that define the updates to the reference table's configuration and properties.                                                                                                       |
| attributes     | description                | string   | Optional text describing the purpose or contents of this reference table.                                                                                                                       |
| attributes     | file_metadata              | <oneOf>  | Metadata specifying where and how to access the reference table's data file.                                                                                                                    |
| file_metadata  | Object 1                   | object   | Cloud storage file metadata for patch requests. Allows partial updates of access_details and sync_enabled.                                                                                      |
| Object 1       | access_details             | object   | Cloud storage access configuration for the reference table data file.                                                                                                                           |
| access_details | aws_detail                 | object   | Amazon Web Services S3 storage access configuration.                                                                                                                                            |
| aws_detail     | aws_account_id             | string   | AWS account ID where the S3 bucket is located.                                                                                                                                                  |
| aws_detail     | aws_bucket_name            | string   | S3 bucket containing the CSV file.                                                                                                                                                              |
| aws_detail     | file_path                  | string   | The relative file path from the S3 bucket root to the CSV file.                                                                                                                                 |
| access_details | azure_detail               | object   | Azure Blob Storage access configuration.                                                                                                                                                        |
| azure_detail   | azure_client_id            | string   | Azure service principal (application) client ID with permissions to read from the container.                                                                                                    |
| azure_detail   | azure_container_name       | string   | Azure Blob Storage container containing the CSV file.                                                                                                                                           |
| azure_detail   | azure_storage_account_name | string   | Azure storage account where the container is located.                                                                                                                                           |
| azure_detail   | azure_tenant_id            | string   | Azure Active Directory tenant ID.                                                                                                                                                               |
| azure_detail   | file_path                  | string   | The relative file path from the Azure container root to the CSV file.                                                                                                                           |
| access_details | gcp_detail                 | object   | Google Cloud Platform storage access configuration.                                                                                                                                             |
| gcp_detail     | file_path                  | string   | The relative file path from the GCS bucket root to the CSV file.                                                                                                                                |
| gcp_detail     | gcp_bucket_name            | string   | GCP bucket containing the CSV file.                                                                                                                                                             |
| gcp_detail     | gcp_project_id             | string   | GCP project ID where the bucket is located.                                                                                                                                                     |
| gcp_detail     | gcp_service_account_email  | string   | Service account email with read permissions for the GCS bucket.                                                                                                                                 |
| Object 1       | sync_enabled               | boolean  | Whether this table is synced automatically.                                                                                                                                                     |
| file_metadata  | Object 2                   | object   | Local file metadata for patch requests using upload ID.                                                                                                                                         |
| Object 2       | upload_id [*required*]     | string   | The upload ID.                                                                                                                                                                                  |
| attributes     | schema                     | object   | Schema defining the updates to the structure and columns of the reference table. Schema fields cannot be deleted or renamed.                                                                    |
| schema         | fields [*required*]        | [object] | The schema fields. Maximum of 200 columns.                                                                                                                                                      |
| fields         | name [*required*]          | string   | The field name.                                                                                                                                                                                 |
| fields         | type [*required*]          | enum     | The field type for reference table schema fields. Allowed enum values: `STRING`, `INT32`.                                                                                                       |
| schema         | primary_keys [*required*]  | [string] | List of field names that serve as primary keys for the table. Only one primary key is supported, and it is used as an ID to retrieve rows. Primary keys cannot be changed after table creation. |
| attributes     | tags                       | [string] | Tags for organizing and filtering reference tables.                                                                                                                                             |
| data           | type [*required*]          | enum     | Reference table resource type. Allowed enum values: `reference_table`. Default: `reference_table`.                                                                                              |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "description": "example description",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "123456789000",
            "aws_bucket_name": "example-data-bucket",
            "file_path": "reference-tables/users.csv"
          },
          "azure_detail": {
            "azure_client_id": "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb",
            "azure_container_name": "reference-data",
            "azure_storage_account_name": "examplestorageaccount",
            "azure_tenant_id": "cccccccc-4444-5555-6666-dddddddddddd",
            "file_path": "tables/users.csv"
          },
          "gcp_detail": {
            "file_path": "data/reference_tables/users.csv",
            "gcp_bucket_name": "example-data-bucket",
            "gcp_project_id": "example-gcp-project-12345",
            "gcp_service_account_email": "example-service@example-gcp-project-12345.iam.gserviceaccount.com"
          }
        },
        "sync_enabled": false
      },
      "schema": {
        "fields": [
          {
            "name": "field_1",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "field_1"
        ]
      },
      "tags": [
        "tag_1",
        "tag_2"
      ]
    },
    "type": "reference_table"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK
{% /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="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 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "this is a cloud table generated via a cloud bucket sync",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "test-account-id",
            "aws_bucket_name": "test-bucket",
            "file_path": "test_rt.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "id",
            "type": "INT32"
          },
          {
            "name": "name",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "id"
        ]
      },
      "tags": [
        "test_tag"
      ]
    },
    "type": "reference_table"
  }
}
EOF
```
{% /tab %}

{% tab label="Go" %}
```go
// Update reference table returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

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

func main() {
	body := datadogV2.PatchTableRequest{
		Data: &datadogV2.PatchTableRequestData{
			Attributes: &datadogV2.PatchTableRequestDataAttributes{
				Description: datadog.PtrString("this is a cloud table generated via a cloud bucket sync"),
				FileMetadata: &datadogV2.PatchTableRequestDataAttributesFileMetadata{
					PatchTableRequestDataAttributesFileMetadataCloudStorage: &datadogV2.PatchTableRequestDataAttributesFileMetadataCloudStorage{
						AccessDetails: &datadogV2.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails{
							AwsDetail: &datadogV2.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail{
								AwsAccountId:  datadog.PtrString("test-account-id"),
								AwsBucketName: datadog.PtrString("test-bucket"),
								FilePath:      datadog.PtrString("test_rt.csv"),
							},
						},
						SyncEnabled: datadog.PtrBool(true),
					}},
				Schema: &datadogV2.PatchTableRequestDataAttributesSchema{
					Fields: []datadogV2.PatchTableRequestDataAttributesSchemaFieldsItems{
						{
							Name: "id",
							Type: datadogV2.REFERENCETABLESCHEMAFIELDTYPE_INT32,
						},
						{
							Name: "name",
							Type: datadogV2.REFERENCETABLESCHEMAFIELDTYPE_STRING,
						},
					},
					PrimaryKeys: []string{
						"id",
					},
				},
				Tags: []string{
					"test_tag",
				},
			},
			Type: datadogV2.PATCHTABLEREQUESTDATATYPE_REFERENCE_TABLE,
		},
	}
	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.NewReferenceTablesApi(apiClient)
	r, err := api.UpdateReferenceTable(ctx, "id", body)

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

#### 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 reference table returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ReferenceTablesApi;
import com.datadog.api.client.v2.model.PatchTableRequest;
import com.datadog.api.client.v2.model.PatchTableRequestData;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributes;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadata;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataCloudStorage;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesSchema;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesSchemaFieldsItems;
import com.datadog.api.client.v2.model.PatchTableRequestDataType;
import com.datadog.api.client.v2.model.ReferenceTableSchemaFieldType;
import java.util.Arrays;
import java.util.Collections;

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

    PatchTableRequest body =
        new PatchTableRequest()
            .data(
                new PatchTableRequestData()
                    .attributes(
                        new PatchTableRequestDataAttributes()
                            .description("this is a cloud table generated via a cloud bucket sync")
                            .fileMetadata(
                                new PatchTableRequestDataAttributesFileMetadata(
                                    new PatchTableRequestDataAttributesFileMetadataCloudStorage()
                                        .accessDetails(
                                            new PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails()
                                                .awsDetail(
                                                    new PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail()
                                                        .awsAccountId("test-account-id")
                                                        .awsBucketName("test-bucket")
                                                        .filePath("test_rt.csv")))
                                        .syncEnabled(true)))
                            .schema(
                                new PatchTableRequestDataAttributesSchema()
                                    .fields(
                                        Arrays.asList(
                                            new PatchTableRequestDataAttributesSchemaFieldsItems()
                                                .name("id")
                                                .type(ReferenceTableSchemaFieldType.INT32),
                                            new PatchTableRequestDataAttributesSchemaFieldsItems()
                                                .name("name")
                                                .type(ReferenceTableSchemaFieldType.STRING)))
                                    .primaryKeys(Collections.singletonList("id")))
                            .tags(Collections.singletonList("test_tag")))
                    .type(PatchTableRequestDataType.REFERENCE_TABLE));

    try {
      apiInstance.updateReferenceTable("id", body);
    } catch (ApiException e) {
      System.err.println("Exception when calling ReferenceTablesApi#updateReferenceTable");
      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 reference table returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
from datadog_api_client.v2.model.patch_table_request import PatchTableRequest
from datadog_api_client.v2.model.patch_table_request_data import PatchTableRequestData
from datadog_api_client.v2.model.patch_table_request_data_attributes import PatchTableRequestDataAttributes
from datadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_cloud_storage import (
    PatchTableRequestDataAttributesFileMetadataCloudStorage,
)
from datadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_one_of_access_details import (
    PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails,
)
from datadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_one_of_access_details_aws_detail import (
    PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail,
)
from datadog_api_client.v2.model.patch_table_request_data_attributes_schema import PatchTableRequestDataAttributesSchema
from datadog_api_client.v2.model.patch_table_request_data_attributes_schema_fields_items import (
    PatchTableRequestDataAttributesSchemaFieldsItems,
)
from datadog_api_client.v2.model.patch_table_request_data_type import PatchTableRequestDataType
from datadog_api_client.v2.model.reference_table_schema_field_type import ReferenceTableSchemaFieldType

body = PatchTableRequest(
    data=PatchTableRequestData(
        attributes=PatchTableRequestDataAttributes(
            description="this is a cloud table generated via a cloud bucket sync",
            file_metadata=PatchTableRequestDataAttributesFileMetadataCloudStorage(
                access_details=PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails(
                    aws_detail=PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail(
                        aws_account_id="test-account-id",
                        aws_bucket_name="test-bucket",
                        file_path="test_rt.csv",
                    ),
                ),
                sync_enabled=True,
            ),
            schema=PatchTableRequestDataAttributesSchema(
                fields=[
                    PatchTableRequestDataAttributesSchemaFieldsItems(
                        name="id",
                        type=ReferenceTableSchemaFieldType.INT32,
                    ),
                    PatchTableRequestDataAttributesSchemaFieldsItems(
                        name="name",
                        type=ReferenceTableSchemaFieldType.STRING,
                    ),
                ],
                primary_keys=[
                    "id",
                ],
            ),
            tags=[
                "test_tag",
            ],
        ),
        type=PatchTableRequestDataType.REFERENCE_TABLE,
    ),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = ReferenceTablesApi(api_client)
    api_instance.update_reference_table(id="id", body=body)
```

#### 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 reference table returns "OK" response

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

body = DatadogAPIClient::V2::PatchTableRequest.new({
  data: DatadogAPIClient::V2::PatchTableRequestData.new({
    attributes: DatadogAPIClient::V2::PatchTableRequestDataAttributes.new({
      description: "this is a cloud table generated via a cloud bucket sync",
      file_metadata: DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataCloudStorage.new({
        access_details: DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails.new({
          aws_detail: DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail.new({
            aws_account_id: "test-account-id",
            aws_bucket_name: "test-bucket",
            file_path: "test_rt.csv",
          }),
        }),
        sync_enabled: true,
      }),
      schema: DatadogAPIClient::V2::PatchTableRequestDataAttributesSchema.new({
        fields: [
          DatadogAPIClient::V2::PatchTableRequestDataAttributesSchemaFieldsItems.new({
            name: "id",
            type: DatadogAPIClient::V2::ReferenceTableSchemaFieldType::INT32,
          }),
          DatadogAPIClient::V2::PatchTableRequestDataAttributesSchemaFieldsItems.new({
            name: "name",
            type: DatadogAPIClient::V2::ReferenceTableSchemaFieldType::STRING,
          }),
        ],
        primary_keys: [
          "id",
        ],
      }),
      tags: [
        "test_tag",
      ],
    }),
    type: DatadogAPIClient::V2::PatchTableRequestDataType::REFERENCE_TABLE,
  }),
})
p api_instance.update_reference_table("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 reference table returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_reference_tables::ReferenceTablesAPI;
use datadog_api_client::datadogV2::model::PatchTableRequest;
use datadog_api_client::datadogV2::model::PatchTableRequestData;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributes;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadata;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataCloudStorage;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesSchema;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesSchemaFieldsItems;
use datadog_api_client::datadogV2::model::PatchTableRequestDataType;
use datadog_api_client::datadogV2::model::ReferenceTableSchemaFieldType;

#[tokio::main]
async fn main() {
    let body =
        PatchTableRequest
        ::new().data(
            PatchTableRequestData::new(
                PatchTableRequestDataType::REFERENCE_TABLE,
            ).attributes(
                PatchTableRequestDataAttributes::new()
                    .description("this is a cloud table generated via a cloud bucket sync".to_string())
                    .file_metadata(
                        PatchTableRequestDataAttributesFileMetadata
                        ::PatchTableRequestDataAttributesFileMetadataCloudStorage(
                            Box::new(
                                PatchTableRequestDataAttributesFileMetadataCloudStorage::new()
                                    .access_details(
                                        PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails
                                        ::new().aws_detail(
                                            PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail
                                            ::new()
                                                .aws_account_id("test-account-id".to_string())
                                                .aws_bucket_name("test-bucket".to_string())
                                                .file_path("test_rt.csv".to_string()),
                                        ),
                                    )
                                    .sync_enabled(true),
                            ),
                        ),
                    )
                    .schema(
                        PatchTableRequestDataAttributesSchema::new(
                            vec![
                                PatchTableRequestDataAttributesSchemaFieldsItems::new(
                                    "id".to_string(),
                                    ReferenceTableSchemaFieldType::INT32,
                                ),
                                PatchTableRequestDataAttributesSchemaFieldsItems::new(
                                    "name".to_string(),
                                    ReferenceTableSchemaFieldType::STRING,
                                )
                            ],
                            vec!["id".to_string()],
                        ),
                    )
                    .tags(vec!["test_tag".to_string()]),
            ),
        );
    let configuration = datadog::Configuration::new();
    let api = ReferenceTablesAPI::with_config(configuration);
    let resp = api.update_reference_table("id".to_string(), 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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Update reference table 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.ReferenceTablesApi(configuration);

const params: v2.ReferenceTablesApiUpdateReferenceTableRequest = {
  body: {
    data: {
      attributes: {
        description: "this is a cloud table generated via a cloud bucket sync",
        fileMetadata: {
          accessDetails: {
            awsDetail: {
              awsAccountId: "test-account-id",
              awsBucketName: "test-bucket",
              filePath: "test_rt.csv",
            },
          },
          syncEnabled: true,
        },
        schema: {
          fields: [
            {
              name: "id",
              type: "INT32",
            },
            {
              name: "name",
              type: "STRING",
            },
          ],
          primaryKeys: ["id"],
        },
        tags: ["test_tag"],
      },
      type: "reference_table",
    },
  },
  id: "id",
};

apiInstance
  .updateReferenceTable(params)
  .then((data: any) => {
    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 %}
