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.1

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.1
File Size Uploaded Provenance Actions
amocrm_api_wrapper-1.0.1.tar.gz 47.4 kB Without provenance Details for amocrm_api_wrapper-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 102.8 kB

Release files / amocrm_api_wrapper-1.0.1.tar.gz

Download URL amocrm_api_wrapper-1.0.1.tar.gz
Size 47.4 kB
Tags Source
SHA-256 checksum
How to use checksums
40f293ac2c04440c8384dc2ed3002f48380fb9da97cfebc999d516dc9b29dbef
BLAKE2b-256 checksum
How to use checksums
cefdbe767e1a7f7260f9e5457da444a6f9122c3428c47b1b82b554bbaec46a48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.1-py3-none-any.whl

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

Security for amocrm-api-wrapper 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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