Skip to content

Too Many Requests error when bulk editing YNAB merchants #31

@SamEdwardes

Description

@SamEdwardes

This may be unavoidable, but I was hit with a too many requests error when trying to bulk edit merchants in YNAB. There was approximately 160 transactions where the merchant name was changing.

2025-11-07 13:49:09,939 - moneyflow.data_manager - ERROR - Transaction update 162/162 FAILED: (429)
Reason: Too Many Requests
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 07 Nov 2025 21:49:09 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'heroku-connect-time': '0.392', 'heroku-desired-backends': '3', 'heroku-dyno-id': 'd6cf8f4e-57e9-4e7b-ba5e-670853dcafdf', 'heroku-dyno-name': 'web.3', 'heroku-router-availability-zone': 'us-east-1c', 'heroku-router-instance-name': 'router.2398303', 'heroku-sid': 'va02', 'nel': '{"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}', 'referrer-policy': 'strict-origin-when-cross-origin', 'report-to': '{"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=J1sgN6uaYK0kPF%2FHoZLAQyVrqvxfHPKdxIPZvdI%2FAog%3D\\u0026sid=af571f24-03ee-46d1-9f90-ab9030c2c74c\\u0026ts=1762552149"}],"max_age":3600}', 'reporting-endpoints': 'heroku-nel="https://nel.heroku.com/reports?s=J1sgN6uaYK0kPF%2FHoZLAQyVrqvxfHPKdxIPZvdI%2FAog%3D&sid=af571f24-03ee-46d1-9f90-ab9030c2c74c&ts=1762552149"', 'Server': 'cloudflare', 'strict-transport-security': 'max-age=63072000; includeSubDomains', 'vary': 'Accept-Encoding, Origin', 'via': '2.0 heroku-router', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-permitted-cross-domain-policies': 'none', 'x-request-id': 'a559b105-94cb-d253-b0a1-fb1abb4e6d62', 'x-runtime': '0.008442', 'x-xss-protection': '0', 'cf-cache-status': 'DYNAMIC', 'CF-RAY': '99b009f83bb930a0-SEA', 'alt-svc': 'h3=":443"; ma=86400'})
HTTP response body: {"error":{"id":"429","name":"too_many_requests","detail":"Too many requests"}}
Traceback (most recent call last):
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/moneyflow/backends/ynab.py", line 124, in update_transaction
    return self.client.update_transaction(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        transaction_id=transaction_id,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/moneyflow/ynab_client.py", line 191, in update_transaction
    txn_response = transactions_api.get_transaction_by_id(
        budget_id=self.budget_id, transaction_id=transaction_id
    )
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/pydantic/_internal/_validate_call.py", line 39, in wrapper_function
    return wrapper(*args, **kwargs)
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/pydantic/_internal/_validate_call.py", line 136, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/ynab/api/transactions_api.py", line 690, in get_transaction_by_id
    return self.api_client.response_deserialize(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        response_data=response_data,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        response_types_map=_response_types_map,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ).data
    ^
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/ynab/api_client.py", line 322, in response_deserialize
    raise ApiException.from_response(
          ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        http_resp=response_data,
        ^^^^^^^^^^^^^^^^^^^^^^^^
        body=response_text,
        ^^^^^^^^^^^^^^^^^^^
        data=return_data,
        ^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/samedwardes/Library/Application Support/uv/tools/moneyflow/lib/python3.13/site-packages/ynab/exceptions.py", line 162, in from_response
    raise ApiException(http_resp=http_resp, body=body, data=data)
ynab.exceptions.ApiException: (429)
Reason: Too Many Requests
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 07 Nov 2025 21:49:09 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'heroku-connect-time': '0.392', 'heroku-desired-backends': '3', 'heroku-dyno-id': 'd6cf8f4e-57e9-4e7b-ba5e-670853dcafdf', 'heroku-dyno-name': 'web.3', 'heroku-router-availability-zone': 'us-east-1c', 'heroku-router-instance-name': 'router.2398303', 'heroku-sid': 'va02', 'nel': '{"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}', 'referrer-policy': 'strict-origin-when-cross-origin', 'report-to': '{"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=J1sgN6uaYK0kPF%2FHoZLAQyVrqvxfHPKdxIPZvdI%2FAog%3D\\u0026sid=af571f24-03ee-46d1-9f90-ab9030c2c74c\\u0026ts=1762552149"}],"max_age":3600}', 'reporting-endpoints': 'heroku-nel="https://nel.heroku.com/reports?s=J1sgN6uaYK0kPF%2FHoZLAQyVrqvxfHPKdxIPZvdI%2FAog%3D&sid=af571f24-03ee-46d1-9f90-ab9030c2c74c&ts=1762552149"', 'Server': 'cloudflare', 'strict-transport-security': 'max-age=63072000; includeSubDomains', 'vary': 'Accept-Encoding, Origin', 'via': '2.0 heroku-router', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-permitted-cross-domain-policies': 'none', 'x-request-id': 'a559b105-94cb-d253-b0a1-fb1abb4e6d62', 'x-runtime': '0.008442', 'x-xss-protection': '0', 'cf-cache-status': 'DYNAMIC', 'CF-RAY': '99b009f83bb930a0-SEA', 'alt-svc': 'h3=":443"; ma=86400'})
HTTP response body: {"error":{"id":"429","name":"too_many_requests","detail":"Too many requests"}}

Is there a way to be more efficient with the YNAB API? For example, bulk edits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions