> For the complete documentation index, see [llms.txt](https://docs.usepylon.com/pylon-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.usepylon.com/pylon-docs/developer/api/api-reference/accounts.md).

# Accounts

## Get a list of accounts

> Returns a paginated list of accounts for the organization.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"GetAccountsResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAccountsResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"GetAccountsResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/Account"},"type":"array"},"pagination":{"$ref":"#/components/schemas/Pagination"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Account":{"properties":{"channels":{"description":"Channels associated with the account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"created_at":{"description":"The creation time of the account.","type":"string"},"crm_settings":{"$ref":"#/components/schemas/CRMSettings"},"custom_fields":{"additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"Custom fields associated with the account.","type":"object"},"domain":{"description":"The primary domain of the account.","type":"string"},"domains":{"description":"The list of domains associated with the account.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"External IDs associated with the account.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"id":{"description":"The ID of the account.","type":"string"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"latest_customer_activity_time":{"description":"The time of the latest customer activity.","type":"string"},"logo_url":{"description":"The logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner":{"$ref":"#/components/schemas/MiniUser"},"primary_domain":{"description":"The primary domain of the account.","type":"string"},"tags":{"description":"Tags associated with the account.","items":{"type":"string"},"type":"array"},"type":{"description":"The type of the account.","enum":["customer","internal","community","partner"],"type":"string"},"updated_at":{"description":"The time the account was last updated.","type":"string"}},"type":"object"},"Channel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"channel_name":{"description":"The human-readable name of the channel.","type":"string"},"channel_url":{"description":"The direct URL to the channel in its source app, if available.","type":"string"},"is_internal":{"description":"Whether this is an internal channel (e.g., a triage channel) as opposed to a customer-facing channel.","type":"boolean"},"is_primary":{"description":"Whether this channel is the primary channel for the account.","type":"boolean"},"mirror_to":{"$ref":"#/components/schemas/MirrorChannel"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"MirrorChannel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"CRMSettings":{"properties":{"details":{"description":"List of all CRM details for the account.","items":{"$ref":"#/components/schemas/CRMDetails"},"type":"array"}},"type":"object"},"CRMDetails":{"properties":{"id":{"description":"The ID of the CRM for that source.","type":"string"},"source":{"description":"The source of the CRM.","type":"string"}},"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"ExternalID":{"properties":{"external_id":{"description":"The external ID. Must be unique per object type (ex. account).","type":"string"},"label":{"description":"The label of the external ID. Must be unique per object.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"Pagination":{"properties":{"cursor":{"description":"The cursor for the next page of results.","type":"string"},"has_next_page":{"description":"Indicates if there is a next page of results.","type":"boolean"}},"required":["cursor","has_next_page"],"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/accounts":{"get":{"description":"Returns a paginated list of accounts for the organization.\n\n**Rate limit:** 300 requests per minute","operationId":"GetAccounts","parameters":[{"description":"The cursor to use for pagination.","in":"query","name":"cursor","schema":{"type":"string"}},{"description":"The number of accounts to fetch. Defaults to 100. Must be greater than 0 and less than 1000.","in":"query","name":"limit","schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/GetAccountsResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Get a list of accounts","tags":["accounts"]}}}}
```

## Create a new account

> Creates a new account with the specified name and optional metadata.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"CreateAccountRequest":{"properties":{"account_type":{"default":"customer","description":"The type of the account. Must be one of \"customer\", \"internal\", \"community\", or \"partner\". Defaults to \"customer\" if not specified.","enum":["customer","internal","community","partner"],"type":"string"},"channels":{"description":"An array of channels to be linked to this account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"custom_fields":{"description":"An array of custom fields to be used on this account.","items":{"$ref":"#/components/schemas/CustomFieldValue"},"type":"array"},"domain":{"description":"Deprecated. Please use Domains and PrimaryDomain instead.","type":"string"},"domains":{"description":"The domains of the account, without any leading scheme, for example stripe.com. Must specify one domain as primary.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"An array of external IDs to be used on this account. If provided, the account's external IDs will be updated to the given external IDs.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"logo_url":{"description":"The logo URL of the account. Must be a square .png, .jpg or .jpeg.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner_id":{"description":"The ID of the owner of the account.","type":"string"},"primary_domain":{"description":"Must be in the list of domains. If there are any domains, there must be exactly one primary domain.","type":"string"},"subaccount_ids":{"description":"An array of account IDs to be added as subaccounts to this account. For normal accounts, these represent subaccounts. For partner accounts, these represent associated accounts.","items":{"type":"string"},"type":"array"},"tags":{"description":"An array of strings to use as tags on this account. If provided, the accounts tags will be updated to the given tags.","items":{"type":"string"},"type":"array"}},"required":["name"],"type":"object"},"Channel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"channel_name":{"description":"The human-readable name of the channel.","type":"string"},"channel_url":{"description":"The direct URL to the channel in its source app, if available.","type":"string"},"is_internal":{"description":"Whether this is an internal channel (e.g., a triage channel) as opposed to a customer-facing channel.","type":"boolean"},"is_primary":{"description":"Whether this channel is the primary channel for the account.","type":"boolean"},"mirror_to":{"$ref":"#/components/schemas/MirrorChannel"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"MirrorChannel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"ExternalID":{"properties":{"external_id":{"description":"The external ID. Must be unique per object type (ex. account).","type":"string"},"label":{"description":"The label of the external ID. Must be unique per object.","type":"string"}},"type":"object"},"CreateAccountResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/Account"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Account":{"properties":{"channels":{"description":"Channels associated with the account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"created_at":{"description":"The creation time of the account.","type":"string"},"crm_settings":{"$ref":"#/components/schemas/CRMSettings"},"custom_fields":{"additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"Custom fields associated with the account.","type":"object"},"domain":{"description":"The primary domain of the account.","type":"string"},"domains":{"description":"The list of domains associated with the account.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"External IDs associated with the account.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"id":{"description":"The ID of the account.","type":"string"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"latest_customer_activity_time":{"description":"The time of the latest customer activity.","type":"string"},"logo_url":{"description":"The logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner":{"$ref":"#/components/schemas/MiniUser"},"primary_domain":{"description":"The primary domain of the account.","type":"string"},"tags":{"description":"Tags associated with the account.","items":{"type":"string"},"type":"array"},"type":{"description":"The type of the account.","enum":["customer","internal","community","partner"],"type":"string"},"updated_at":{"description":"The time the account was last updated.","type":"string"}},"type":"object"},"CRMSettings":{"properties":{"details":{"description":"List of all CRM details for the account.","items":{"$ref":"#/components/schemas/CRMDetails"},"type":"array"}},"type":"object"},"CRMDetails":{"properties":{"id":{"description":"The ID of the CRM for that source.","type":"string"},"source":{"description":"The source of the CRM.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}},"responses":{"CreateAccountResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/accounts":{"post":{"description":"Creates a new account with the specified name and optional metadata.\n\n**Rate limit:** 300 requests per minute","operationId":"CreateAccount","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/CreateAccountResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Create a new account","tags":["accounts"]}}}}
```

## Update multiple accounts

> Updates multiple accounts in a single request. Only provided fields are modified.\
> \
> \*\*Rate limit:\*\* 120 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"UpdateAccountsRequest":{"properties":{"account_ids":{"description":"The account IDs to update. The number of accounts to update must be between 1 and 100.","items":{"type":"string"},"type":"array"},"account_type":{"description":"The type of the account. Can only be changed to \"customer\" or \"partner\".","enum":["customer","partner"],"type":"string"},"custom_fields":{"description":"An array of custom fields to be updated on the accounts.","items":{"$ref":"#/components/schemas/CustomFieldValue"},"type":"array"},"owner_id":{"description":"The ID of the new owner. If empty string is passed in, the owner will be removed.","type":"string"},"tags":{"description":"An array of tags to be updated on the accounts.","items":{"type":"string"},"type":"array"},"tags_apply_mode":{"default":"replace","description":"The mode for applying tags. Valid values: \"append_only\", \"remove_only\", \"replace\". Defaults to \"replace\".","enum":["append_only","remove_only","replace"],"type":"string"}},"required":["account_ids"],"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"UpdateAccountsResponseBody":{"properties":{"request_id":{"description":"The request ID for tracking.","type":"string"},"success":{"description":"Whether the update was successfully initiated.","type":"boolean"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}},"responses":{"UpdateAccountsResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountsResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/accounts":{"patch":{"description":"Updates multiple accounts in a single request. Only provided fields are modified.\n\n**Rate limit:** 120 requests per minute","operationId":"UpdateAccounts","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/UpdateAccountsResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Update multiple accounts","tags":["accounts"]}}}}
```

## Get an account by its ID or external ID

> Returns a single account by ID or external ID.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"GetAccountResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAccountResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"GetAccountResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/Account"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Account":{"properties":{"channels":{"description":"Channels associated with the account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"created_at":{"description":"The creation time of the account.","type":"string"},"crm_settings":{"$ref":"#/components/schemas/CRMSettings"},"custom_fields":{"additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"Custom fields associated with the account.","type":"object"},"domain":{"description":"The primary domain of the account.","type":"string"},"domains":{"description":"The list of domains associated with the account.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"External IDs associated with the account.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"id":{"description":"The ID of the account.","type":"string"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"latest_customer_activity_time":{"description":"The time of the latest customer activity.","type":"string"},"logo_url":{"description":"The logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner":{"$ref":"#/components/schemas/MiniUser"},"primary_domain":{"description":"The primary domain of the account.","type":"string"},"tags":{"description":"Tags associated with the account.","items":{"type":"string"},"type":"array"},"type":{"description":"The type of the account.","enum":["customer","internal","community","partner"],"type":"string"},"updated_at":{"description":"The time the account was last updated.","type":"string"}},"type":"object"},"Channel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"channel_name":{"description":"The human-readable name of the channel.","type":"string"},"channel_url":{"description":"The direct URL to the channel in its source app, if available.","type":"string"},"is_internal":{"description":"Whether this is an internal channel (e.g., a triage channel) as opposed to a customer-facing channel.","type":"boolean"},"is_primary":{"description":"Whether this channel is the primary channel for the account.","type":"boolean"},"mirror_to":{"$ref":"#/components/schemas/MirrorChannel"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"MirrorChannel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"CRMSettings":{"properties":{"details":{"description":"List of all CRM details for the account.","items":{"$ref":"#/components/schemas/CRMDetails"},"type":"array"}},"type":"object"},"CRMDetails":{"properties":{"id":{"description":"The ID of the CRM for that source.","type":"string"},"source":{"description":"The source of the CRM.","type":"string"}},"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"ExternalID":{"properties":{"external_id":{"description":"The external ID. Must be unique per object type (ex. account).","type":"string"},"label":{"description":"The label of the external ID. Must be unique per object.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/accounts/{id}":{"get":{"description":"Returns a single account by ID or external ID.\n\n**Rate limit:** 300 requests per minute","operationId":"GetAccount","parameters":[{"description":"The ID or external ID of the account to fetch.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/GetAccountResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Get an account by its ID or external ID","tags":["accounts"]}}}}
```

## Update an existing account

> Updates an existing account by ID or external ID. Only provided fields are modified.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"UpdateAccountRequestBody":{"properties":{"account_type":{"description":"The type of the account. Can only be changed to \"customer\" or \"partner\".","enum":["customer","partner"],"type":"string"},"channels":{"description":"An array of channels to be linked to this account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"custom_fields":{"description":"An array of custom fields to be used on this account.","items":{"$ref":"#/components/schemas/CustomFieldValue"},"type":"array"},"domains":{"description":"Domains of the account. Must specify one domain as primary.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"An array of external IDs to be used on this account. If provided, the account's external IDs will be updated to the given external IDs.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"logo_url":{"description":"Logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner_id":{"description":"The ID of the owner of the account. If empty string is passed in, the owner will be removed.","type":"string"},"primary_domain":{"description":"Must be in the list of domains. If there are any domains, there must be exactly one primary domain.","type":"string"},"subaccount_ids":{"description":"An array of account IDs to be added as subaccounts to this account.","items":{"type":"string"},"type":"array"},"tags":{"description":"An array of strings to use as tags on this account. If provided, the accounts tags will be updated to the given tags.","items":{"type":"string"},"type":"array"}},"type":"object"},"Channel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"channel_name":{"description":"The human-readable name of the channel.","type":"string"},"channel_url":{"description":"The direct URL to the channel in its source app, if available.","type":"string"},"is_internal":{"description":"Whether this is an internal channel (e.g., a triage channel) as opposed to a customer-facing channel.","type":"boolean"},"is_primary":{"description":"Whether this channel is the primary channel for the account.","type":"boolean"},"mirror_to":{"$ref":"#/components/schemas/MirrorChannel"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"MirrorChannel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"ExternalID":{"properties":{"external_id":{"description":"The external ID. Must be unique per object type (ex. account).","type":"string"},"label":{"description":"The label of the external ID. Must be unique per object.","type":"string"}},"type":"object"},"UpdateAccountResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/Account"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Account":{"properties":{"channels":{"description":"Channels associated with the account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"created_at":{"description":"The creation time of the account.","type":"string"},"crm_settings":{"$ref":"#/components/schemas/CRMSettings"},"custom_fields":{"additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"Custom fields associated with the account.","type":"object"},"domain":{"description":"The primary domain of the account.","type":"string"},"domains":{"description":"The list of domains associated with the account.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"External IDs associated with the account.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"id":{"description":"The ID of the account.","type":"string"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"latest_customer_activity_time":{"description":"The time of the latest customer activity.","type":"string"},"logo_url":{"description":"The logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner":{"$ref":"#/components/schemas/MiniUser"},"primary_domain":{"description":"The primary domain of the account.","type":"string"},"tags":{"description":"Tags associated with the account.","items":{"type":"string"},"type":"array"},"type":{"description":"The type of the account.","enum":["customer","internal","community","partner"],"type":"string"},"updated_at":{"description":"The time the account was last updated.","type":"string"}},"type":"object"},"CRMSettings":{"properties":{"details":{"description":"List of all CRM details for the account.","items":{"$ref":"#/components/schemas/CRMDetails"},"type":"array"}},"type":"object"},"CRMDetails":{"properties":{"id":{"description":"The ID of the CRM for that source.","type":"string"},"source":{"description":"The source of the CRM.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}},"responses":{"UpdateAccountResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/accounts/{id}":{"patch":{"description":"Updates an existing account by ID or external ID. Only provided fields are modified.\n\n**Rate limit:** 300 requests per minute","operationId":"UpdateAccount","parameters":[{"description":"The ID or external ID of the account to update.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountRequestBody"}}}},"responses":{"200":{"$ref":"#/components/responses/UpdateAccountResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Update an existing account","tags":["accounts"]}}}}
```

## Delete an existing account

> Permanently deletes an account by ID or external ID.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"DeleteAccountResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAccountResponseBody"}}},"description":""}},"schemas":{"DeleteAccountResponseBody":{"properties":{"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/accounts/{id}":{"delete":{"description":"Permanently deletes an account by ID or external ID.\n\n**Rate limit:** 30 requests per minute","operationId":"DeleteAccount","parameters":[{"description":"The ID or external ID of the account to delete.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/DeleteAccountResponse"}},"summary":"Delete an existing account","tags":["accounts"]}}}}
```

## Search for accounts by a given filter

> Optionally pass \`search\_text\` for fuzzy matching. Results are intersected with any provided filter.\
> \
> Filterable fields and their allowed operators:\
> \
> &#x20;Field | Allowed operators |\
> &#x20;\--- | --- |\
> &#x20;\`id\` | \`equals\`, \`in\`, \`not\_in\` |\
> &#x20;\`domains\` | \`contains\`, \`does\_not\_contain\`, \`in\`, \`not\_in\` |\
> &#x20;\`tags\` | \`contains\`, \`does\_not\_contain\`, \`in\`, \`not\_in\` |\
> &#x20;\`name\` | \`equals\`, \`in\`, \`not\_in\`, \`string\_contains\` |\
> &#x20;\`external\_ids\` | \`equals\`, \`in\`, \`not\_in\`, \`is\_set\`, \`is\_unset\` |\
> &#x20;\`owner\_id\` | \`equals\`, \`in\`, \`not\_in\`, \`is\_set\`, \`is\_unset\` |\
> \
> For custom fields, pass the field slug as \`field\`.\
> \
> \*\*Rate limit:\*\* 120 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"SearchAccountsRequest":{"properties":{"cursor":{"description":"The cursor to use for pagination.","type":"string"},"filter":{"$ref":"#/components/schemas/Filter"},"limit":{"description":"The number of accounts to fetch. Defaults to 100. Must be greater than 0 and less than 1000.","format":"int64","type":"integer"},"search_text":{"description":"Fuzzy text search. Results are intersected with any provided filter.","type":"string"}},"type":"object"},"Filter":{"properties":{"field":{"description":"The field for this filter.  For allowed fields, see the documentation for\nthe specific endpoint you are using.\nFor non-compound filters (any operators other than \"and\" or \"or\"),\nfield must be set, along with either value or values, depending on the operator.","type":"string"},"operator":{"description":"The operator for this filter.","enum":["equals","not_equals","contains","does_not_contain","in","not_in","and","or","time_is_after","time_is_before","time_range","string_contains","string_does_not_contain","is_set","is_unset","greater_than","less_than","greater_than_or_equals","less_than_or_equals"],"type":"string"},"subfilters":{"description":"Sub-filters for this filter.  Valid only when operator is \"and\" or \"or\".\nThe maximum allowed depth for a tree of filters is 3.","items":{"$ref":"#/components/schemas/Filter"},"type":"array"},"value":{"description":"The value for this filter. Only used for single-valued operators\n(\"equals\", \"not_equals\", \"contains\", \"does_not_contain\")","type":"string"},"values":{"description":"The values for this filter. Only used for multi-valued operators (\"in\", \"not_in\").","items":{"type":"string"},"type":"array"}},"required":["operator"],"type":"object"},"SearchAccountsResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/Account"},"type":"array"},"pagination":{"$ref":"#/components/schemas/Pagination"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Account":{"properties":{"channels":{"description":"Channels associated with the account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"created_at":{"description":"The creation time of the account.","type":"string"},"crm_settings":{"$ref":"#/components/schemas/CRMSettings"},"custom_fields":{"additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"Custom fields associated with the account.","type":"object"},"domain":{"description":"The primary domain of the account.","type":"string"},"domains":{"description":"The list of domains associated with the account.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"External IDs associated with the account.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"id":{"description":"The ID of the account.","type":"string"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"latest_customer_activity_time":{"description":"The time of the latest customer activity.","type":"string"},"logo_url":{"description":"The logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner":{"$ref":"#/components/schemas/MiniUser"},"primary_domain":{"description":"The primary domain of the account.","type":"string"},"tags":{"description":"Tags associated with the account.","items":{"type":"string"},"type":"array"},"type":{"description":"The type of the account.","enum":["customer","internal","community","partner"],"type":"string"},"updated_at":{"description":"The time the account was last updated.","type":"string"}},"type":"object"},"Channel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"channel_name":{"description":"The human-readable name of the channel.","type":"string"},"channel_url":{"description":"The direct URL to the channel in its source app, if available.","type":"string"},"is_internal":{"description":"Whether this is an internal channel (e.g., a triage channel) as opposed to a customer-facing channel.","type":"boolean"},"is_primary":{"description":"Whether this channel is the primary channel for the account.","type":"boolean"},"mirror_to":{"$ref":"#/components/schemas/MirrorChannel"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"MirrorChannel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"CRMSettings":{"properties":{"details":{"description":"List of all CRM details for the account.","items":{"$ref":"#/components/schemas/CRMDetails"},"type":"array"}},"type":"object"},"CRMDetails":{"properties":{"id":{"description":"The ID of the CRM for that source.","type":"string"},"source":{"description":"The source of the CRM.","type":"string"}},"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"ExternalID":{"properties":{"external_id":{"description":"The external ID. Must be unique per object type (ex. account).","type":"string"},"label":{"description":"The label of the external ID. Must be unique per object.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"Pagination":{"properties":{"cursor":{"description":"The cursor for the next page of results.","type":"string"},"has_next_page":{"description":"Indicates if there is a next page of results.","type":"boolean"}},"required":["cursor","has_next_page"],"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}},"responses":{"SearchAccountsResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchAccountsResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/accounts/search":{"post":{"description":"Optionally pass `search_text` for fuzzy matching. Results are intersected with any provided filter.\n\nFilterable fields and their allowed operators:\n\n Field | Allowed operators |\n --- | --- |\n `id` | `equals`, `in`, `not_in` |\n `domains` | `contains`, `does_not_contain`, `in`, `not_in` |\n `tags` | `contains`, `does_not_contain`, `in`, `not_in` |\n `name` | `equals`, `in`, `not_in`, `string_contains` |\n `external_ids` | `equals`, `in`, `not_in`, `is_set`, `is_unset` |\n `owner_id` | `equals`, `in`, `not_in`, `is_set`, `is_unset` |\n\nFor custom fields, pass the field slug as `field`.\n\n**Rate limit:** 120 requests per minute","operationId":"SearchAccounts","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchAccountsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/SearchAccountsResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Search for accounts by a given filter","tags":["accounts"]}}}}
```

## Merge accounts

> Merges one or more accounts into a surviving account. Issues, contacts, opportunities, domains, channels, external IDs, and other associated data are transferred to the surviving account. Tags and custom field values of the merged accounts are not transferred. The merged accounts are permanently deleted. This cannot be undone. Accounts are merged sequentially, each in its own transaction; if a merge fails partway through, accounts already merged are not restored.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"MergeAccountsRequest":{"properties":{"merge_account_ids":{"description":"The IDs of the accounts to merge into the surviving account. These accounts are permanently deleted after their data is transferred. The number of accounts to merge must be between 1 and 100.","items":{"type":"string"},"type":"array"},"merge_into_account_id":{"description":"The ID of the account that will survive the merge and receive the merged data.","type":"string"}},"required":["merge_into_account_id","merge_account_ids"],"type":"object"},"MergeAccountsResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/Account"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"Account":{"properties":{"channels":{"description":"Channels associated with the account.","items":{"$ref":"#/components/schemas/Channel"},"type":"array"},"created_at":{"description":"The creation time of the account.","type":"string"},"crm_settings":{"$ref":"#/components/schemas/CRMSettings"},"custom_fields":{"additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"Custom fields associated with the account.","type":"object"},"domain":{"description":"The primary domain of the account.","type":"string"},"domains":{"description":"The list of domains associated with the account.","items":{"type":"string"},"type":"array"},"external_ids":{"description":"External IDs associated with the account.","items":{"$ref":"#/components/schemas/ExternalID"},"type":"array"},"id":{"description":"The ID of the account.","type":"string"},"is_disabled":{"description":"Whether the account is disabled.","type":"boolean"},"latest_customer_activity_time":{"description":"The time of the latest customer activity.","type":"string"},"logo_url":{"description":"The logo URL of the account.","type":"string"},"name":{"description":"The name of the account.","type":"string"},"owner":{"$ref":"#/components/schemas/MiniUser"},"primary_domain":{"description":"The primary domain of the account.","type":"string"},"tags":{"description":"Tags associated with the account.","items":{"type":"string"},"type":"array"},"type":{"description":"The type of the account.","enum":["customer","internal","community","partner"],"type":"string"},"updated_at":{"description":"The time the account was last updated.","type":"string"}},"type":"object"},"Channel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"channel_name":{"description":"The human-readable name of the channel.","type":"string"},"channel_url":{"description":"The direct URL to the channel in its source app, if available.","type":"string"},"is_internal":{"description":"Whether this is an internal channel (e.g., a triage channel) as opposed to a customer-facing channel.","type":"boolean"},"is_primary":{"description":"Whether this channel is the primary channel for the account.","type":"boolean"},"mirror_to":{"$ref":"#/components/schemas/MirrorChannel"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"MirrorChannel":{"properties":{"channel_id":{"description":"The ID of the channel. If this is a Microsoft Teams channel, the ID must be in the format of `{team_id}|{channel_id}`.","type":"string"},"source":{"description":"The channel source. This can be any supported integration source.","type":"string"}},"type":"object"},"CRMSettings":{"properties":{"details":{"description":"List of all CRM details for the account.","items":{"$ref":"#/components/schemas/CRMDetails"},"type":"array"}},"type":"object"},"CRMDetails":{"properties":{"id":{"description":"The ID of the CRM for that source.","type":"string"},"source":{"description":"The source of the CRM.","type":"string"}},"type":"object"},"CustomFieldValue":{"properties":{"slug":{"description":"The slug of the custom field.","type":"string"},"value":{"description":"The value of the custom field. Only to be used for single-valued custom fields. If unset, the custom field will be unset. If the custom field is a select field, the value must be the select option slug, which you can find from the GET /custom-fields endpoint. If the custom field is a relationship field, the value must be the related object ID.","type":"string"},"values":{"description":"The values of the custom field. Only to be used for multi-valued custom fields (ex. multiselect). If unset, the custom field will be unset. If the custom field is a multiselect field, the values must be the select option slugs which you can find from the GET /custom-fields endpoint.","items":{"type":"string"},"type":"array"}},"type":"object"},"ExternalID":{"properties":{"external_id":{"description":"The external ID. Must be unique per object type (ex. account).","type":"string"},"label":{"description":"The label of the external ID. Must be unique per object.","type":"string"}},"type":"object"},"MiniUser":{"properties":{"email":{"description":"The email of the user.","type":"string"},"id":{"description":"The ID of the user.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}},"responses":{"MergeAccountsResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeAccountsResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/accounts/merge":{"post":{"description":"Merges one or more accounts into a surviving account. Issues, contacts, opportunities, domains, channels, external IDs, and other associated data are transferred to the surviving account. Tags and custom field values of the merged accounts are not transferred. The merged accounts are permanently deleted. This cannot be undone. Accounts are merged sequentially, each in its own transaction; if a merge fails partway through, accounts already merged are not restored.\n\n**Rate limit:** 30 requests per minute","operationId":"MergeAccounts","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeAccountsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/MergeAccountsResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Merge accounts","tags":["accounts"]}}}}
```

## Get account relationships

> Returns the parent-child and partner-client relationships where the account is the child or client.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"GetAccountRelationshipsResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAccountRelationshipsResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"GetAccountRelationshipsResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/AccountRelationship"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"AccountRelationship":{"properties":{"child_account_id":{"description":"The ID of the account on the child or client side of the relationship.","type":"string"},"created_at":{"description":"The creation time of the relationship.","type":"string"},"id":{"description":"The ID of the relationship.","type":"string"},"parent_account_id":{"description":"The ID of the account on the parent or partner side of the relationship.","type":"string"},"related_object_id":{"description":"The ID of the related parent or partner account.","type":"string"},"relationship_type":{"description":"The relationship type. One of \"parent_account\" or \"partner_account\".","type":"string"},"updated_at":{"description":"The time the relationship was last updated.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/accounts/{account_id}/relationships":{"get":{"description":"Returns the parent-child and partner-client relationships where the account is the child or client.\n\n**Rate limit:** 300 requests per minute","operationId":"GetAccountRelationships","parameters":[{"description":"The ID of the child or client account whose relationships should be returned.","in":"path","name":"account_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/GetAccountRelationshipsResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Get account relationships","tags":["accounts"]}}}}
```

## Create an account relationship

> Creates a parent or partner relationship for the account in the URL.\
> \
> \*\*Rate limit:\*\* 120 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"CreateAccountRelationshipRequest":{"properties":{"related_object_id":{"description":"The ID of the related parent or partner account.","type":"string"},"relationship_type":{"description":"The relationship type. Must be \"parent_account\" or \"partner_account\".","type":"string"}},"required":["related_object_id","relationship_type"],"type":"object"},"CreateAccountRelationshipResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/AccountRelationship"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"AccountRelationship":{"properties":{"child_account_id":{"description":"The ID of the account on the child or client side of the relationship.","type":"string"},"created_at":{"description":"The creation time of the relationship.","type":"string"},"id":{"description":"The ID of the relationship.","type":"string"},"parent_account_id":{"description":"The ID of the account on the parent or partner side of the relationship.","type":"string"},"related_object_id":{"description":"The ID of the related parent or partner account.","type":"string"},"relationship_type":{"description":"The relationship type. One of \"parent_account\" or \"partner_account\".","type":"string"},"updated_at":{"description":"The time the relationship was last updated.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}},"responses":{"CreateAccountRelationshipResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountRelationshipResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/accounts/{account_id}/relationship":{"post":{"description":"Creates a parent or partner relationship for the account in the URL.\n\n**Rate limit:** 120 requests per minute","operationId":"CreateAccountRelationship","parameters":[{"description":"The ID of the child or client account.","in":"path","name":"account_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountRelationshipRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/CreateAccountRelationshipResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Create an account relationship","tags":["accounts"]}}}}
```

## Delete an account relationship

> Deletes an account relationship by ID.\
> \
> \*\*Rate limit:\*\* 120 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"servers":[{"url":"https://api.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"DeleteAccountRelationshipResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAccountRelationshipResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"DeleteAccountRelationshipResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/AccountRelationship"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"},"AccountRelationship":{"properties":{"child_account_id":{"description":"The ID of the account on the child or client side of the relationship.","type":"string"},"created_at":{"description":"The creation time of the relationship.","type":"string"},"id":{"description":"The ID of the relationship.","type":"string"},"parent_account_id":{"description":"The ID of the account on the parent or partner side of the relationship.","type":"string"},"related_object_id":{"description":"The ID of the related parent or partner account.","type":"string"},"relationship_type":{"description":"The relationship type. One of \"parent_account\" or \"partner_account\".","type":"string"},"updated_at":{"description":"The time the relationship was last updated.","type":"string"}},"type":"object"},"ErrorApiResponseBody":{"properties":{"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"type":"object"}}},"paths":{"/accounts/{account_id}/relationships/{relationship_id}":{"delete":{"description":"Deletes an account relationship by ID.\n\n**Rate limit:** 120 requests per minute","operationId":"DeleteAccountRelationship","parameters":[{"description":"The ID of the child or client account.","in":"path","name":"account_id","required":true,"schema":{"type":"string"}},{"description":"The ID of the account relationship to delete.","in":"path","name":"relationship_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/DeleteAccountRelationshipResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Delete an account relationship","tags":["accounts"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.usepylon.com/pylon-docs/developer/api/api-reference/accounts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
