# Labels ## Retrieve all labels `client.apiGateway.labels.list(LabelListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/zones/{zone_id}/api_gateway/labels` Retrieve all labels ### Parameters - `params: LabelListParams` - `zone_id: string` Path param: Identifier. - `direction?: "asc" | "desc"` Query param: Direction to order results. - `"asc"` - `"desc"` - `filter?: string` Query param: Filter for labels where the name or description matches using substring match - `order?: "name" | "description" | "created_at" | 2 more` Query param: Field to order by - `"name"` - `"description"` - `"created_at"` - `"last_updated"` - `"mapped_resources.operations"` - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Maximum number of results per page. - `source?: "user" | "managed"` Query param: Filter for labels with source - `"user"` - `"managed"` - `with_mapped_resource_counts?: boolean` Query param: Include `mapped_resources` for each label ### Returns - `LabelListResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const labelListResponse of client.apiGateway.labels.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(labelListResponse.created_at); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user", "mapped_resources": { "operations": 29 } } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Label List Response - `LabelListResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # User ## Create user labels `client.apiGateway.labels.user.bulkCreate(UserBulkCreateParamsparams, RequestOptionsoptions?): SinglePage` **post** `/zones/{zone_id}/api_gateway/labels/user` Create user labels ### Parameters - `params: UserBulkCreateParams` - `zone_id: string` Path param: Identifier. - `body: Array` Body param - `name: string` The name of the label - `description?: string` The description of the label - `metadata?: unknown` Metadata for the label ### Returns - `UserBulkCreateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const userBulkCreateResponse of client.apiGateway.labels.user.bulkCreate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [{ name: 'login' }], })) { console.log(userBulkCreateResponse.created_at); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Delete user labels `client.apiGateway.labels.user.bulkDelete(UserBulkDeleteParamsparams, RequestOptionsoptions?): SinglePage` **delete** `/zones/{zone_id}/api_gateway/labels/user` Delete user labels ### Parameters - `params: UserBulkDeleteParams` - `zone_id: string` Identifier. ### Returns - `UserBulkDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const userBulkDeleteResponse of client.apiGateway.labels.user.bulkDelete({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(userBulkDeleteResponse.created_at); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Retrieve user label `client.apiGateway.labels.user.get(stringname, UserGetParamsparams, RequestOptionsoptions?): UserGetResponse` **get** `/zones/{zone_id}/api_gateway/labels/user/{name}` Retrieve user label ### Parameters - `name: string` The name of the label - `params: UserGetParams` - `zone_id: string` Path param: Identifier. - `with_mapped_resource_counts?: boolean` Query param: Include `mapped_resources` for each label ### Returns - `UserGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const user = await client.apiGateway.labels.user.get('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(user.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user", "mapped_resources": { "operations": 29 } }, "success": true } ``` ## Update user label `client.apiGateway.labels.user.update(stringname, UserUpdateParamsparams, RequestOptionsoptions?): UserUpdateResponse` **put** `/zones/{zone_id}/api_gateway/labels/user/{name}` Update all fields on a label ### Parameters - `name: string` The name of the label - `params: UserUpdateParams` - `zone_id: string` Path param: Identifier. - `description?: string` Body param: The description of the label - `metadata?: unknown` Body param: Metadata for the label ### Returns - `UserUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const user = await client.apiGateway.labels.user.update('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(user.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" }, "success": true } ``` ## Patch user label `client.apiGateway.labels.user.edit(stringname, UserEditParamsparams, RequestOptionsoptions?): UserEditResponse` **patch** `/zones/{zone_id}/api_gateway/labels/user/{name}` Update certain fields on a label ### Parameters - `name: string` The name of the label - `params: UserEditParams` - `zone_id: string` Path param: Identifier. - `description?: string` Body param: The description of the label - `metadata?: unknown` Body param: Metadata for the label ### Returns - `UserEditResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.apiGateway.labels.user.edit('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" }, "success": true } ``` ## Delete user label `client.apiGateway.labels.user.delete(stringname, UserDeleteParamsparams, RequestOptionsoptions?): UserDeleteResponse` **delete** `/zones/{zone_id}/api_gateway/labels/user/{name}` Delete user label ### Parameters - `name: string` The name of the label - `params: UserDeleteParams` - `zone_id: string` Identifier. ### Returns - `UserDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const user = await client.apiGateway.labels.user.delete('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(user.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user" }, "success": true } ``` ## Domain Types ### User Bulk Create Response - `UserBulkCreateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Bulk Delete Response - `UserBulkDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Get Response - `UserGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### User Update Response - `UserUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Edit Response - `UserEditResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` ### User Delete Response - `UserDeleteResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` # Resources # Operation ## Replace operation(s) attached to a user label `client.apiGateway.labels.user.resources.operation.update(stringname, OperationUpdateParamsparams, RequestOptionsoptions?): OperationUpdateResponse` **put** `/zones/{zone_id}/api_gateway/labels/user/{name}/resources/operation` Replace all operations(s) attached to a user label ### Parameters - `name: string` The name of the label - `params: OperationUpdateParams` - `zone_id: string` Path param: Identifier. - `selector: Selector` Body param: Operation IDs selector - `include: Include` - `operation_ids: Array` ### Returns - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.labels.user.resources.operation.update('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', selector: { include: { operation_ids: ['f174e90a-fafe-4643-bbbc-4a0ed4fc8415'] } }, }); console.log(operation.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "user", "mapped_resources": { "operations": 29 } }, "success": true } ``` ## Domain Types ### Operation Update Response - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # Managed ## Retrieve managed label `client.apiGateway.labels.managed.get(stringname, ManagedGetParamsparams, RequestOptionsoptions?): ManagedGetResponse` **get** `/zones/{zone_id}/api_gateway/labels/managed/{name}` Retrieve managed label ### Parameters - `name: string` The name of the label - `params: ManagedGetParams` - `zone_id: string` Path param: Identifier. - `with_mapped_resource_counts?: boolean` Query param: Include `mapped_resources` for each label ### Returns - `ManagedGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const managed = await client.apiGateway.labels.managed.get('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(managed.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "managed", "mapped_resources": { "operations": 29 } }, "success": true } ``` ## Domain Types ### Managed Get Response - `ManagedGetResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label # Resources # Operation ## Replace operation(s) attached to a managed label `client.apiGateway.labels.managed.resources.operation.update(stringname, OperationUpdateParamsparams, RequestOptionsoptions?): OperationUpdateResponse` **put** `/zones/{zone_id}/api_gateway/labels/managed/{name}/resources/operation` Replace all operations(s) attached to a managed label ### Parameters - `name: string` The name of the label - `params: OperationUpdateParams` - `zone_id: string` Path param: Identifier. - `selector: Selector` Body param: Operation IDs selector - `include: Include` - `operation_ids: Array` ### Returns - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const operation = await client.apiGateway.labels.managed.resources.operation.update('login', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', selector: { include: { operation_ids: ['f174e90a-fafe-4643-bbbc-4a0ed4fc8415'] } }, }); console.log(operation.created_at); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "created_at": "2014-01-01T05:20:00.12345Z", "description": "All endpoints that deal with logins", "last_updated": "2014-01-01T05:20:00.12345Z", "metadata": { "foo": "bar" }, "name": "login", "source": "managed", "mapped_resources": { "operations": 29 } }, "success": true } ``` ## Domain Types ### Operation Update Response - `OperationUpdateResponse` - `created_at: string` - `description: string` The description of the label - `last_updated: string` - `metadata: unknown` Metadata for the label - `name: string` The name of the label - `source: "user" | "managed"` * `user` - label is owned by the user * `managed` - label is owned by cloudflare - `"user"` - `"managed"` - `mapped_resources?: unknown` Provides counts of what resources are linked to this label