set_passport_data_errors()

async Client.set_passport_data_errors()

Inform a user that some Telegram Passport elements they provided contain errors.

The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).

Use this if the data submitted by the user doesn’t satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc.

Usable by Users Bots
Parameters:
  • user_id (int | str) – Unique identifier (int) or username (str) of the user whose Passport data you want to set errors for.

  • errors (list) – A list of PassportElementError objects describing the errors.

Returns:

bool – True on success.

Example

from pyrogram.types import PassportElementErrorDataField

await app.set_passport_data_errors(user_id, [
    PassportElementErrorDataField(
        type="personal_details",
        field_name="first_name",
        data_hash="hash",
        message="First name is invalid",
    )
])