# 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. ### 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. - `per_page?: number` Query param: Number of objects to return per page. ### Returns - `RecipientListResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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 ```node 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(stringshareId, stringrecipientId, RecipientGetParamsparams, RequestOptionsoptions?): RecipientGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Get share recipient by ID. ### Parameters - `shareId: string` Share identifier tag. - `recipientId: string` Share Recipient identifier tag. - `params: RecipientGetParams` - `account_id: string` Path param: Account identifier. - `include_resources?: boolean` Query param: Include resources in the response. ### Returns - `RecipientGetResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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 ```node 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', '3fd85f74b32742f1bff64a85009dda07', { 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 } ] } } ``` ## Create a new share recipient `client.resourceSharing.recipients.create(stringshareId, RecipientCreateParamsparams, RequestOptionsoptions?): RecipientCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/recipients` Adds a recipient to a resource share, granting them access to the shared resources. ### Parameters - `shareId: string` Share identifier tag. - `params: RecipientCreateParams` - `body_account_id?: string` Body param: Account identifier. - `organization_id?: string` Body param: Organization identifier. ### Returns - `RecipientCreateResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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 ```node 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(stringshareId, stringrecipientId, RecipientDeleteParamsparams, RequestOptionsoptions?): RecipientDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Deletion is not immediate, an updated share recipient object with a new status will be returned. ### Parameters - `shareId: string` Share identifier tag. - `recipientId: string` Share Recipient identifier tag. - `params: RecipientDeleteParams` - `account_id: string` Account identifier. ### Returns - `RecipientDeleteResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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 ```node 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', '3fd85f74b32742f1bff64a85009dda07', { 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 } ] } } ``` ## Domain Types ### Recipient List Response - `RecipientListResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"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.