zaepho.zohobooks.zohobooks_account module – Manage ZohoBooks chart of accounts

Note

This module is part of the zaepho.zohobooks collection (version 0.3.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install zaepho.zohobooks.

To use it in a playbook, specify: zaepho.zohobooks.zohobooks_account.

New in zaepho.zohobooks 0.1.0

Synopsis

  • Create, update, or delete accounts in ZohoBooks chart of accounts

  • Idempotent operations based on account name

Parameters

Parameter

Comments

access_token

string

ZohoBooks API access token

Can also be set via ZOHO_ACCESS_TOKEN environment variable

account_code

string

Account code/number

account_name

string / required

Name of the account

account_type

string

Type of account

Zoho Books does not publicly document a complete, closed list of account types (their own API docs trail off with “…and more”), so this list reflects known-good values rather than a guaranteed-exhaustive set. If the API adds/accepts a new type this list doesn’t cover yet, it will need to be extended here.

Choices:

  • "other_asset"

  • "other_current_asset"

  • "cash"

  • "bank"

  • "fixed_asset"

  • "stock"

  • "accounts_receivable"

  • "other_current_liability"

  • "credit_card"

  • "long_term_liability"

  • "other_liability"

  • "accounts_payable"

  • "equity"

  • "income"

  • "other_income"

  • "expense"

  • "cost_of_goods_sold"

  • "other_expense"

api_domain

string

ZohoBooks API domain

Can also be set via ZOHO_API_DOMAIN environment variable

Default: "https://www.zohoapis.com"

description

string

Description of the account

is_sub_account

boolean

Whether this is a sub-account

Choices:

  • false ← (default)

  • true

organization_id

string

ZohoBooks organization ID

Can also be set via ZOHO_ORGANIZATION_ID environment variable

parent_account_id

string

Parent account ID for sub-accounts

state

string

Desired state of the account

Choices:

  • "present" ← (default)

  • "absent"

Examples

- name: Create a bank account (using explicit parameters)
  zohobooks_account:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    account_name: "Business Checking"
    account_type: "bank"
    account_code: "1001"
    description: "Primary business checking account"
    state: present

- name: Create account using environment variables
  zohobooks_account:
    account_name: "Business Savings"
    account_type: "bank"
    account_code: "1002"
    description: "Business savings account"
    state: present
  environment:
    ZOHO_ORGANIZATION_ID: "123456789"
    ZOHO_ACCESS_TOKEN: "your_access_token"
    ZOHO_API_DOMAIN: "https://www.zohoapis.com"

- name: Create a sub-account
  zohobooks_account:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    account_name: "Office Supplies"
    account_type: "expense"
    parent_account_id: "987654321"
    is_sub_account: true
    state: present

- name: Update an existing account
  zohobooks_account:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    account_name: "Business Checking"
    description: "Updated description"
    state: present

- name: Delete an account
  zohobooks_account:
    organization_id: "123456789"
    access_token: "{{ zoho_access_token }}"
    account_name: "Old Account"
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

account

dictionary

Account details

Returned: when state is present

Sample: {"account_code": "1001", "account_id": "123456789", "account_name": "Business Checking", "account_type": "bank", "description": "Primary business checking account"}

changed

boolean

Whether the account was changed

Returned: always

msg

string

Information about the operation

Returned: always

Authors

  • Kevin Colby (@zaepho)