Skip to main content

wrapper for amocrm rest api

Install

Install using pip...

pip install amocrm-api-wrapper

Async support

Every method has an async twin with the _async suffix (e.g. get_leads_async). Async variants use httpx.AsyncClient natively and return awaitables:

import asyncio
from amocrm_api import AmoOAuthClient

async def main():
    client = AmoOAuthClient('<access_token>', '<refresh_token>', '<crm_url>', '<client_id>', '<client_secret>', '<redirect_uri>')
    leads = await client.get_leads_async()
    print(leads)
    await client.close_async()

asyncio.run(main())

For the legacy client the async session is initialized lazily on the first async call, no extra setup is required:

import asyncio
from amocrm_api import AmoLegacyClient

async def main():
    client = AmoLegacyClient('<login>', '<token>', '<crm_url>')
    users = await client.get_users_async()
    print(users)

asyncio.run(main())

Pagination

Methods that return collections across pages (iter_*) fetch all pages lazily, so you don't have to manage page/limit manually. Sync variants are generators, async variants are async generators:

# sync
for lead in client.iter_leads(filters={"name": "x"}):
    print(lead["id"])

# async
async for contact in client.iter_contacts_async():
    print(contact["id"])

Available iterators:

Method Async twin Notes
iter_leads iter_leads_async
iter_contacts iter_contacts_async
iter_companies iter_companies_async
iter_tasks iter_tasks_async
iter_catalog_elements(catalog_id, ...) iter_catalog_elements_async
iter_tags_by_entity_type(entity_type, ...) iter_tags_by_entity_type_async

All accept the same filters/order/with-params as the corresponding get_* methods, but the page argument is handled for you.

Usage

from amocrm_api import AmoLegacyClient # for login password auth
from amocrm_api import AmoOAuthClient # for oauth
from datetime import datetime

client = AmoLegacyClient('<login>', '<password>', '<crm_url>')
client = AmoOAuthClient('<access_token>', '<refresh_token>', '<crm_url>', '<client_id>', '<client_secret>', '<redirect_uri>')
dt = datetime.datetime.today().strftime("%a, %d %b %Y %H-%m-%d")
date_time = f"{dt} UTC"

# for Legacy client
headers = {
    "IF-MODIFIED-SINCE": f"{date_time}",
    "Content-Type": "application/json",
}

client.update_session_params(headers)

Documentation

Per-entity API reference is split into docs/. Every method has an async twin with the _async suffix; each file ends with an async usage example:

Entity File
Account docs/account.md
Leads docs/leads.md
Unsorted leads docs/unsorted.md
Pipelines docs/pipelines.md
Contacts docs/contacts.md
Companies docs/companies.md
Customers docs/customers.md
Catalogs docs/catalogs.md
Tasks docs/tasks.md
Notes docs/notes.md
Events docs/events.md
Tags docs/tags.md
Loss reasons docs/loss_reasons.md
Sources docs/sources.md
Chats docs/chats.md
Users docs/users.md
Webhooks docs/webhooks.md
Widgets docs/widgets.md
Custom fields docs/custom_fields.md

See CHANGELOG.md for release history.

Metadata

Release files for amocrm-api-wrapper 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amocrm-api-wrapper 1.0.0
File Size Uploaded
amocrm_api_wrapper-1.0.0.tar.gz 47.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for amocrm-api-wrapper 1.0.0
File Interpreter ABI Platform
amocrm_api_wrapper-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 102.7 kB

Release files / amocrm_api_wrapper-1.0.0.tar.gz

Download URL amocrm_api_wrapper-1.0.0.tar.gz
Size 47.4 kB
Tags Source
SHA-256 checksum
How to use checksums
49ef7d5e1e618fdda724337d3195ca3e9b0a3ab6b05b6c0bb2b51326f8a087ce
BLAKE2b-256 checksum
How to use checksums
7eae286a2f01e191e5ab8f9c2a6dd156a4792124c52d5339e9d67926fad5f0bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / amocrm_api_wrapper-1.0.0-py3-none-any.whl

Download URL amocrm_api_wrapper-1.0.0-py3-none-any.whl
Size 55.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b8f2da2e5598050747e59211d17d40f1561b7d769bd94bd9ba015c1f4a39abd
BLAKE2b-256 checksum
How to use checksums
a42dfdfdacf9c0adb3d7aed88336c61f2541cc89549e9f3eb4784a2d95d29422
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page