// 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.security.createApiKey({
  name: "my-restricted-api-key",
  expiration: "7d",
  role_descriptors: {
    "my-restricted-role-descriptor": {
      indices: [
        {
          names: ["website-product-search"],
          privileges: ["read"],
        },
      ],
      restriction: {
        workflows: ["search_application_query"],
      },
    },
  },
});
console.log(response);
----
