// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples

[source, js]
----
const response = await client.transport.request({
  method: "POST",
  path: "/_security/api_key/_bulk_update",
  body: {
    ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"],
    role_descriptors: {
      "role-a": {
        indices: [
          {
            names: ["*"],
            privileges: ["write"],
          },
        ],
      },
    },
    metadata: {
      environment: {
        level: 2,
        trusted: true,
        tags: ["production"],
      },
    },
    expiration: "30d",
  },
});
console.log(response);
----
