Image Attachment Fails with 403 Error
I was unable to send PNG image through the API, return 403 error:
[403] Unable to prepare file attachment -> Image.png
Reason: ��5��..
Code Example unofficial-claude-api version: 0.3.3
from claude_api.client import ClaudeAPIClient
from claude_api.session import SessionData
COOKIE = "user_cookie_here"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
ORG_ID = "organization_id_here"
session = SessionData(COOKIE, USER_AGENT, ORG_ID)
client = ClaudeAPIClient(session)
chat_id = client.create_chat()
res = client.send_message(
chat_id,
"Please describe this image.",
attachment_paths=["Image.png"]
)
- Would be great to have settings
extendedthinking mode.
I confirm this issue is present globally, I suspect it's because Claude updated its API.
By running the README example on my end I got a different warning, along Claude's answer, I used updated versions of both selenium and geckodriver.
This is the output of the README example:
[403] Unable to prepare file attachment -> test.png
Reason: {"error":{"message":"We are unable to serve your request","type":"permission_error"}}
<... Claude's response saying it didn't received an image ...>
The warning message arises from __prepare_file_attachment because of a 403 (Forbidden) error.
I'm sorry for the inconvenience, I can't provide a resolution deadline at the moment, as I'm involved in other work, but I will surely investigate further on this problem, and be willing to accept any contributions.
Thanks for your patience.
hi, i'm also getting the error returned from claude
HTTP/1.1 403 Forbidden Date: Wed, 07 May 2025 03:09:13 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: close Set-Cookie: __cf_bm=[REDACTED]; path=/; expires=Wed, 07-May-25 03:39:13 GMT; domain=.claude.ai; HttpOnly; Secure; SameSite=None Vary: Accept-Encoding X-Robots-Tag: none Server: cloudflare CF-RAY: 93bd84710a0984e8-HKG Content-Encoding: gzip alt-svc: h3=":443"; ma=86400
{ "error": { "message": "We are unable to serve your request", "type": "permission_error" } }