Skip to content

node-zendeskDocs


node-zendesk / clients/core/organizations / Organizations

Class: Organizations

Client for interacting with the Zendesk Organizations API.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/

Extends

Constructors

new Organizations()

new Organizations(options): Organizations

Parameters

options: any

Returns

Organizations

Overrides

Client.constructor

Defined in

clients/core/organizations.d.ts:149

Properties

_transporter

_transporter: Transporter

Inherited from

Client._transporter

Defined in

clients/client.d.ts:42


eventTarget

eventTarget: CustomEventTarget

Event target to handle custom events.

Inherited from

Client.eventTarget

Defined in

clients/client.d.ts:40


jsonAPINames

jsonAPINames: string[]

Array to hold names used in the JSON API.

Overrides

Client.jsonAPINames

Defined in

clients/core/organizations.d.ts:150


options

options: ZendeskClientOptions & object

Configuration options for the client.

Type declaration

get()

get: (key) => any

Parameters

key: string

Returns

any

Inherited from

Client.options

Defined in

clients/client.d.ts:34


sideLoad

sideLoad: any[]

Array to handle side-loaded resources.

Inherited from

Client.sideLoad

Defined in

clients/client.d.ts:37


useDotJson

useDotJson: boolean

Flag to indicate if the API endpoint should use '.json' ending.

Inherited from

Client.useDotJson

Defined in

clients/client.d.ts:39

Accessors

transporter

Get Signature

get transporter(): Transporter

Returns

Transporter

Transporter for making requests.

Inherited from

Client.transporter

Defined in

clients/client.d.ts:41

Methods

_rawRequest()

_rawRequest(method, uri, ...arguments_): Promise<object>

Parameters

method: any

uri: any

• ...arguments_: any[]

Returns

Promise<object>

response

response: any

result

result: object

Inherited from

Client._rawRequest

Defined in

clients/client.d.ts:78


autocomplete()

autocomplete(parameters): Promise<Organization[]>

Autocompletes organization names based on provided parameters.

Parameters

parameters: object

Parameters for autocomplete.

Returns

Promise<Organization[]>

List of organizations matching the autocomplete.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#autocomplete-organizations

Example

ts
const autocompleteResults = await client.organizations.autocomplete({ name: 'Test' });

Defined in

clients/core/organizations.d.ts:329


bulkDelete()

bulkDelete(organizationIds): Promise<object>

Deletes multiple organizations based on their IDs.

Parameters

organizationIds: number[]

Array of organization IDs.

Returns

Promise<object>

Returns a job status JSON object.

Throws

Throws an error if deletion fails.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#bulk-delete-organizations

Example

ts
await client.organizations.bulkDelete([12345, 67890]);

Defined in

clients/core/organizations.d.ts:304


bulkDeleteByExternalId()

bulkDeleteByExternalId(organizationExternalIds): Promise<object>

Deletes multiple organizations based on their external IDs.

Parameters

organizationExternalIds: string[]

Array of organization external IDs.

Returns

Promise<object>

Returns a job status JSON object.

Throws

Throws an error if deletion fails.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#bulk-delete-organizations

Example

ts
await client.organizations.bulkDeleteByExternalId(['ext-12345', 'ext-67890']);

Defined in

clients/core/organizations.d.ts:313


count()

count(): Promise<number>

Counts the number of organizations.

Returns

Promise<number>

Number of organizations.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#count-organizations

Example

ts
const orgCount = await client.organizations.count();

Defined in

clients/core/organizations.d.ts:172


countByUser()

countByUser(userID): Promise<number>

Counts the number of organizations associated with a specific user.

Parameters

userID: number

The ID of the user.

Returns

Promise<number>

Number of organizations associated with the user.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#count-organizations

Example

ts
const userOrgCount = await client.organizations.countByUser(12345);

Defined in

clients/core/organizations.d.ts:180


create()

create(organization): Promise<object>

Creates a new organization.

Parameters

organization: CreateOrganization

The organization object to create.

Returns

Promise<object>

The created organization's details.

response

response: object

result

result: Organization

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-organization

Example

ts
const newOrganization = await client.organizations.create({ organization: { name: 'New Org' }});

Defined in

clients/core/organizations.d.ts:226


createMany()

createMany(organizations): Promise<object>

Creates multiple organizations.

Parameters

organizations: CreateManyOrganizations

An array of organization objects to create.

Returns

Promise<object>

Details of the created organizations.

response

response: object

result

result: Organization[]

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-many-organizations

Example

ts
const newOrganizations = await client.organizations.createMany({ organizations: [{ name: 'Org1' }, { name: 'Org2' }] });

Defined in

clients/core/organizations.d.ts:237


createOrUpdate()

createOrUpdate(organization): Promise<object>

Creates or updates an organization.

Parameters

organization: CreateOrganization | UpdateOrganizationWithId

The organization object to create or update.

Returns

Promise<object>

The created or updated organization's details.

response

response: object

result

result: Organization

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-or-update-organization

Example

ts
const org = await client.organizations.createOrUpdate({ organization: { id: 12345, name: 'Updated Name' }});

Defined in

clients/core/organizations.d.ts:248


delete()

delete(organizationID): Promise<void>

Deletes a specific organization by its ID.

Parameters

organizationID: number

The ID of the organization to delete.

Returns

Promise<void>

Throws

Throws an error if deletion fails.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#delete-organization

Example

ts
await client.organizations.delete(12345);

Overrides

Client.delete

Defined in

clients/core/organizations.d.ts:295


emit()

emit(eventType, eventData): void

Parameters

eventType: any

eventData: any

Returns

void

Inherited from

Client.emit

Defined in

clients/client.d.ts:43


get()

get(resource): Promise<NodeModule>

Parameters

resource: any

Returns

Promise<NodeModule>

Inherited from

Client.get

Defined in

clients/client.d.ts:62


getAll()

getAll(resource): Promise<any[]>

Parameters

resource: any

Returns

Promise<any[]>

Inherited from

Client.getAll

Defined in

clients/client.d.ts:77


incremental()

incremental(startTime): Promise<Organization[]>

Incrementally exports organizations.

Parameters

startTime: string | Date

Start time for incremental export.

Returns

Promise<Organization[]>

List of organizations in the incremental export.

See

https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-organization-export

Example

ts
const exportedOrganizations = await client.organizations.incremental('2023-01-01T12:00:00Z');

Defined in

clients/core/organizations.d.ts:346


incrementalInclude()

incrementalInclude(startTime, include): Promise<Organization[]>

Incrementally exports organizations with an include parameter.

Parameters

startTime: string | Date

Start time for incremental export.

include: string

Data to include in the export.

Returns

Promise<Organization[]>

List of organizations in the incremental export.

See

https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-organization-export

Example

ts
const exportedOrganizations = await client.organizations.incrementalInclude('2023-01-01T12:00:00Z', 'users');

Defined in

clients/core/organizations.d.ts:338


incrementalSample()

incrementalSample(startTime): Promise<object>

Fetches a sample of incremental organization exports.

Parameters

startTime: string | Date

Start time for the sample.

Returns

Promise<object>

Sample list of organizations in the incremental export.

response

response: object

result

result: Organization[]

See

https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-sample-export

Example

ts
const sampleExportedOrganizations = await client.organizations.incrementalSample('2023-01-01T12:00:00Z');

Defined in

clients/core/organizations.d.ts:354


list()

list(): Promise<Organization[]>

Lists all organizations.

Returns

Promise<Organization[]>

The list of organizations.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations

Example

ts
const organizations = await client.organizations.list();

Defined in

clients/core/organizations.d.ts:157


listByUser()

listByUser(userID): Promise<Organization[]>

Lists organizations associated with a specific user.

Parameters

userID: number

The ID of the user.

Returns

Promise<Organization[]>

List of organizations associated with the user.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations

Example

ts
const userOrgs = await client.organizations.listByUser(12345);

Defined in

clients/core/organizations.d.ts:165


on()

on(eventType, callback): void

Parameters

eventType: any

callback: any

Returns

void

Inherited from

Client.on

Defined in

clients/client.d.ts:44


patch()

patch(...arguments_): Promise<void | object>

Patches a resource.

Parameters

• ...arguments_: any[]

The resources or parts of the resource path followed by the body.

Returns

Promise<void | object>

  • Either void or response object

Inherited from

Client.patch

Defined in

clients/client.d.ts:68


post()

post(resource, body): Promise<NodeModule>

Parameters

resource: any

body: any

Returns

Promise<NodeModule>

Inherited from

Client.post

Defined in

clients/client.d.ts:70


put()

put(resource, body): Promise<NodeModule>

Parameters

resource: any

body: any

Returns

Promise<NodeModule>

Inherited from

Client.put

Defined in

clients/client.d.ts:69


related(organizationID): Promise<object>

Retrieves related information for a specific organization.

Parameters

organizationID: number

The ID of the organization.

Returns

Promise<object>

Object containing related information of the organization.

response

response: object

result

result: OrganizationRelatedResponse

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organizations-related-information

Example

ts
const relatedInfo = await client.organizations.related(12345);

Defined in

clients/core/organizations.d.ts:188


request()

request<T>(method, uri, ...arguments_): Promise<NodeModule>

Request method that handles various HTTP methods.

Type Parameters

T

Parameters

method: string

HTTP method (e.g., 'GET', 'POST').

uri: string

The URI for the request.

• ...arguments_: any[]

Additional arguments for the request.

Returns

Promise<NodeModule>

  • The API response.

Inherited from

Client.request

Defined in

clients/client.d.ts:96


requestAll()

requestAll(method, uri, ...arguments_): Promise<any[]>

Parameters

method: any

uri: any

• ...arguments_: any[]

Returns

Promise<any[]>

Inherited from

Client.requestAll

Defined in

clients/client.d.ts:97


requestUpload()

requestUpload(uri, file): Promise<any>

Parameters

uri: any

file: any

Returns

Promise<any>

Inherited from

Client.requestUpload

Defined in

clients/client.d.ts:98


search(externalID): Promise<Organization[]>

Searches organizations based on external ID.

Parameters

externalID: number

Search by externalID.

Returns

Promise<Organization[]>

List of organizations matching the search.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#search-organizations-by-external-id

Example

ts
const foundOrganizations = await client.organizations.search(1234);

Defined in

clients/core/organizations.d.ts:321


setSideLoad()

setSideLoad(array): void

Parameters

array: any

Returns

void

Inherited from

Client.setSideLoad

Defined in

clients/client.d.ts:61


show()

show(organizationID): Promise<object>

Views a specific organization by its ID.

Parameters

organizationID: number

The ID of the organization.

Returns

Promise<object>

The organization's details.

response

response: object

result

result: Organization

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organization

Example

ts
const organization = await client.organizations.show(12345);

Defined in

clients/core/organizations.d.ts:199


showMany()

showMany(organizationIDs): Promise<Organization[]>

Retrieves details of multiple organizations based on their IDs.

Parameters

organizationIDs: number[]

Array of organization IDs.

Returns

Promise<Organization[]>

List of organizations' details.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-many-organizations

Example

ts
const orgDetails = await client.organizations.showMany([12345, 67890]);

Defined in

clients/core/organizations.d.ts:210


showManyByExternalIds()

showManyByExternalIds(externalOrganizationIds): Promise<Organization[]>

Retrieves details of multiple organizations based on their External IDs.

Parameters

externalOrganizationIds: string[]

Array of organization IDs.

Returns

Promise<Organization[]>

List of organizations' details.

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-many-organizations

Example

ts
const orgDetails = await client.organizations.showMany(['12345', '67890']);

Defined in

clients/core/organizations.d.ts:218


update()

update(organizationID, organization): Promise<object>

Updates a specific organization by its ID.

Parameters

organizationID: number

The ID of the organization.

organization: UpdateOrganization

The updated organization object.

Returns

Promise<object>

The updated organization's details.

response

response: object

result

result: Organization

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#update-organization

Example

ts
const updatedOrganization = await client.organizations.update(12345, { organization: { name: 'New Name' }});

Defined in

clients/core/organizations.d.ts:260


updateMany()

updateMany(organizations): Promise<object>

Updates multiple organizations.

Parameters

organizations: UpdateManyOrganizations

An array of organization objects to update.

Returns

Promise<object>

Details of the updated organizations.

response

response: object

result

result: Organization[]

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#update-many-organizations

Example

ts
const updatedOrganizations = await client.organizations.updateMany({ organizations: [{ id: 1, name: 'Updated Org1' }, { id: 2, name: 'Updated Org2' }] });

Defined in

clients/core/organizations.d.ts:271


upsert()

upsert(organization): Promise<object>

Creates or updates an organization, identical to createOrUpdate method.

Parameters

organization: CreateOrganization | UpdateOrganizationWithId

The organization object to upsert.

Returns

Promise<object>

The created or updated organization's details.

response

response: object

result

result: Organization

See

https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-or-update-organization

Example

ts
const org = await client.organizations.upsert({ organization: { id: 12345, name: 'Upserted Name' }});

Deprecated

use createOrUpdate() method instead.

Defined in

clients/core/organizations.d.ts:283

Released under the MIT License.