# Resource Sharing ## List account shares `client.resourceSharing.list(ResourceSharingListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/shares` Lists all account shares. ### Parameters - `params: ResourceSharingListParams` - `account_id: string` Path param: Account identifier. - `direction?: "asc" | "desc"` Query param: Direction to sort objects. - `"asc"` - `"desc"` - `include_recipient_counts?: boolean` Query param: Include recipient counts in the response. - `include_resources?: boolean` Query param: Include resources in the response. - `kind?: "sent" | "received"` Query param: Filter shares by kind. - `"sent"` - `"received"` - `order?: "name" | "created"` Query param: Order shares by values in the given field. - `"name"` - `"created"` - `page?: number` Query param: Page number. Defaults to `1` when `per_page` is supplied without `page`. May be omitted entirely along with `per_page` to receive a non-paginated response. - `per_page?: number` Query param: Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response. - `resource_types?: Array<"custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more>` Query param: Filter share resources by resource_types. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `status?: "active" | "deleting" | "deleted"` Query param: Filter shares by status. - `"active"` - `"deleting"` - `"deleted"` - `tag?: Array` Query param: Filter shares by tag. Each value is either `key=value` (matches shares whose tags contain that key/value pair) or `key` alone (matches shares that have any value for that key). May be repeated; multiple `tag` parameters are ANDed together. Maximum 20 `tag` parameters per request. - `target_type?: "account" | "organization"` Query param: Filter shares by target_type. - `"account"` - `"organization"` ### Returns - `ResourceSharingListResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const resourceSharingListResponse of client.resourceSharing.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(resourceSharingListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 50 } } ``` ## Get account share by ID `client.resourceSharing.get(stringshareID, ResourceSharingGetParamsparams, RequestOptionsoptions?): ResourceSharingGetResponse` **get** `/accounts/{account_id}/shares/{share_id}` Fetches share by ID. ### Parameters - `shareID: string` Share identifier tag. - `params: ResourceSharingGetParams` - `account_id: string` Path param: Account identifier. - `include_recipient_counts?: boolean` Query param: Include recipient counts in the response. - `include_resources?: boolean` Query param: Include resources in the response. ### Returns - `ResourceSharingGetResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.get('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Create a new share `client.resourceSharing.create(ResourceSharingCreateParamsparams, RequestOptionsoptions?): ResourceSharingCreateResponse` **post** `/accounts/{account_id}/shares` Creates a new resource share for sharing Cloudflare resources with other accounts or organizations. ### Parameters - `params: ResourceSharingCreateParams` - `account_id: string` Path param: Account identifier. - `name: string` Body param: The name of the share. - `recipients: Array` Body param - `account_id?: string` Deprecated alias for `recipient_account_id`. Use `recipient_account_id` instead. The body field collided with the URL path parameter of the same name, which prevented SDK generators from distinguishing the source account (in the URL) from the recipient account (in the body). Both names will continue to be accepted until 2027-05-26 (see `x-sunset`). - `organization_id?: string` Organization identifier. - `recipient_account_id?: string` The account that will receive the share. - `resources: Array` Body param - `meta: unknown` Resource Metadata. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` ### Returns - `ResourceSharingCreateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'My Shared WAF Managed Rule', recipients: [{}], resources: [ { meta: {}, resource_account_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_type: 'custom-ruleset', }, ], }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Update a share `client.resourceSharing.update(stringshareID, ResourceSharingUpdateParamsparams, RequestOptionsoptions?): ResourceSharingUpdateResponse` **put** `/accounts/{account_id}/shares/{share_id}` Updates the share's display name and tags. This endpoint does **not** modify recipients or resources — those are managed via dedicated subresource endpoints: - **Recipients**: Use `POST /accounts/{account_id}/shares/{share_id}/recipients` to add a single recipient, `PUT /accounts/{account_id}/shares/{share_id}/recipients` to replace the full recipient list, or `DELETE /accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` to remove a recipient. - **Resources**: Use the share's resource subresource endpoints. Updating is not immediate; an updated share object with a new status will be returned. ### Parameters - `shareID: string` Share identifier tag. - `params: ResourceSharingUpdateParams` - `account_id: string` Path param: Account identifier. - `name: string` Body param: The name of the share. ### Returns - `ResourceSharingUpdateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.update('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'My Shared WAF Managed Rule', }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Delete a share `client.resourceSharing.delete(stringshareID, ResourceSharingDeleteParamsparams, RequestOptionsoptions?): ResourceSharingDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}` Deletion is not immediate, an updated share object with a new status will be returned. ### Parameters - `shareID: string` Share identifier tag. - `params: ResourceSharingDeleteParams` - `account_id: string` Account identifier. ### Returns - `ResourceSharingDeleteResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.delete('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Domain Types ### Resource Sharing List Response - `ResourceSharingListResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Get Response - `ResourceSharingGetResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Create Response - `ResourceSharingCreateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Update Response - `ResourceSharingUpdateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Delete Response - `ResourceSharingDeleteResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` # Recipients ## List share recipients by share ID `client.resourceSharing.recipients.list(stringshareID, RecipientListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/shares/{share_id}/recipients` List share recipients by share ID. Returns **all** recipients regardless of their `association_status` (associating, associated, disassociating, disassociated). Callers that want only "active" recipients must filter client-side on the `association_status` field. ### Parameters - `shareID: string` Share identifier tag. - `params: RecipientListParams` - `account_id: string` Path param: Account identifier. - `include_resources?: boolean` Query param: Include resources in the response. - `page?: number` Query param: Page number. Defaults to `1` when `per_page` is supplied without `page`. May be omitted entirely along with `per_page` to receive a non-paginated response. - `per_page?: number` Query param: Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response. ### Returns - `RecipientListResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const recipientListResponse of client.resourceSharing.recipients.list( '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(recipientListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 50 } } ``` ## Get share recipient by ID `client.resourceSharing.recipients.get(stringrecipientID, RecipientGetParamsparams, RequestOptionsoptions?): RecipientGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Get share recipient by ID. ### Parameters - `recipientID: string` Share Recipient identifier tag. - `params: RecipientGetParams` - `account_id: string` Path param: Account identifier. - `share_id: string` Path param: Share identifier tag. - `include_resources?: boolean` Query param: Include resources in the response. ### Returns - `RecipientGetResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const recipient = await client.resourceSharing.recipients.get('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', share_id: '3fd85f74b32742f1bff64a85009dda07', }); console.log(recipient.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } } ``` ## Create a new share recipient `client.resourceSharing.recipients.create(stringshareID, RecipientCreateParamsparams, RequestOptionsoptions?): RecipientCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/recipients` Adds a single recipient to an account-targeted resource share, granting them access to the shared resources. The recipient account must belong to the same organization as the share owner. To replace the entire recipient list in one call, use `PUT /accounts/{account_id}/shares/{share_id}/recipients` instead. ### Parameters - `shareID: string` Share identifier tag. - `params: RecipientCreateParams` - `body_account_id?: string` Body param: Deprecated alias for `recipient_account_id`. Use `recipient_account_id` instead. The body field collided with the URL path parameter of the same name, which prevented SDK generators from distinguishing the source account (in the URL) from the recipient account (in the body). Both names will continue to be accepted until 2027-05-26 (see `x-sunset`). - `organization_id?: string` Body param: Organization identifier. - `recipient_account_id?: string` Body param: The account that will receive the share. ### Returns - `RecipientCreateResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const recipient = await client.resourceSharing.recipients.create( '3fd85f74b32742f1bff64a85009dda07', { path_account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(recipient.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } } ``` ## Delete a share recipient `client.resourceSharing.recipients.delete(stringrecipientID, RecipientDeleteParamsparams, RequestOptionsoptions?): RecipientDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Performs a **soft delete**: sets the recipient's `desired_association_status` to `disassociated`, which signals the background reconciliation workflow (Temporal) to remove the shared resources from the recipient account. The recipient record remains in the database for audit purposes and is still returned by `GET /accounts/{account_id}/shares/{share_id}/recipients` with its updated status. Resource access is not fully removed until the workflow completes and `current_association_status` transitions to `disassociated`. The recipient record itself is never physically deleted. ### Parameters - `recipientID: string` Share Recipient identifier tag. - `params: RecipientDeleteParams` - `account_id: string` Account identifier. - `share_id: string` Share identifier tag. ### Returns - `RecipientDeleteResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const recipient = await client.resourceSharing.recipients.delete( '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', share_id: '3fd85f74b32742f1bff64a85009dda07' }, ); console.log(recipient.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } } ``` ## Domain Types ### Recipient List Response - `RecipientListResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Recipient Get Response - `RecipientGetResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Recipient Create Response - `RecipientCreateResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Recipient Delete Response - `RecipientDeleteResponse` A recipient of a share. The `association_status` field tracks the lifecycle of the shared resources in the recipient account. All recipients are returned by the list endpoint regardless of status; filter client-side if only active recipients are needed. - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` The current state of the recipient relative to the share. The `desired_association_status` (not exposed in the response) tracks the target state set by the API; the background reconciliation workflow drives `current_association_status` toward it. - `associating` — The recipient was recently added; the workflow is pushing shared resources into the recipient account. - `associated` — Shared resources have been successfully applied to the recipient account. - `disassociating` — The recipient was removed (via DELETE or PUT replacement); the workflow is removing shared resources from the recipient account. - `disassociated` — Shared resources have been removed from the recipient account. The recipient record remains in the database. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. # Resources ## List share resources by share ID `client.resourceSharing.resources.list(stringshareID, ResourceListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/shares/{share_id}/resources` List share resources by share ID. ### Parameters - `shareID: string` Share identifier tag. - `params: ResourceListParams` - `account_id: string` Path param: Account identifier. - `page?: number` Query param: Page number. Defaults to `1` when `per_page` is supplied without `page`. May be omitted entirely along with `per_page` to receive a non-paginated response. - `per_page?: number` Query param: Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response. - `resource_type?: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Query param: Filter share resources by resource_type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `status?: "active" | "deleting" | "deleted"` Query param: Filter share resources by status. - `"active"` - `"deleting"` - `"deleted"` ### Returns - `ResourceListResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const resourceListResponse of client.resourceSharing.resources.list( '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(resourceListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 50 } } ``` ## Get share resource by ID `client.resourceSharing.resources.get(stringshareResourceID, ResourceGetParamsparams, RequestOptionsoptions?): ResourceGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Get share resource by ID. ### Parameters - `shareResourceID: string` Share Resource identifier. - `params: ResourceGetParams` - `account_id: string` Account identifier. - `share_id: string` Share identifier tag. ### Returns - `ResourceGetResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', share_id: '3fd85f74b32742f1bff64a85009dda07', }); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Create a new share resource `client.resourceSharing.resources.create(stringshareID, ResourceCreateParamsparams, RequestOptionsoptions?): ResourceCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/resources` Adds a resource to an existing share, making it available to share recipients. ### Parameters - `shareID: string` Share identifier tag. - `params: ResourceCreateParams` - `account_id: string` Path param: Account identifier. - `meta: unknown` Body param: Resource Metadata. - `resource_account_id: string` Body param: Account identifier. - `resource_id: string` Body param: Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Body param: Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` ### Returns - `ResourceCreateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.create('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', meta: {}, resource_account_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_type: 'custom-ruleset', }); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Update a share resource `client.resourceSharing.resources.update(stringshareResourceID, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse` **put** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Update is not immediate, an updated share resource object with a new status will be returned. ### Parameters - `shareResourceID: string` Share Resource identifier. - `params: ResourceUpdateParams` - `account_id: string` Path param: Account identifier. - `share_id: string` Path param: Share identifier tag. - `meta: unknown` Body param: Resource Metadata. ### Returns - `ResourceUpdateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.update('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', share_id: '3fd85f74b32742f1bff64a85009dda07', meta: {}, }); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Delete a share resource `client.resourceSharing.resources.delete(stringshareResourceID, ResourceDeleteParamsparams, RequestOptionsoptions?): ResourceDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Deletion is not immediate, an updated share resource object with a new status will be returned. ### Parameters - `shareResourceID: string` Share Resource identifier. - `params: ResourceDeleteParams` - `account_id: string` Account identifier. - `share_id: string` Share identifier tag. ### Returns - `ResourceDeleteResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', share_id: '3fd85f74b32742f1bff64a85009dda07', }); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Domain Types ### Resource List Response - `ResourceListResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Get Response - `ResourceGetResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Create Response - `ResourceCreateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Update Response - `ResourceUpdateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Delete Response - `ResourceDeleteResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 3 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"`