Getting 401 Error with Android integration

Getting 401 Unauthorized Error Despite Valid API Key and Correct Endpoint

Hi Roboflow community,

I’m experiencing a persistent 401 “Unauthorized api_key” error when calling my deployed workflow, and I’ve tried everything I can think of. Here are the details:

Workflow: phclassifier2 (classification model)

Endpoint: https://serverless.roboflow.com/vdimagesrecognition/workflows/phclassifier2

API Key: verifiedOK!

What I’ve verified:

  • :white_check_mark: API key is correct and active in my Roboflow dashboard

  • :white_check_mark: Workflow is deployed and shows as “Active”

  • :white_check_mark: Endpoint URL matches exactly what’s shown in the deployment instructions

  • :white_check_mark: Request format matches the cURL example exactly

  • :white_check_mark: Same API key works for other workflows in the same project

Request format:

{

"api_key": "\*\*\*\*\*\*\*\*\*\*\*\*\*\*",

"inputs": {

    "image": {"type": "url", "value": "https://firebasestorage.googleapis.com/..."}

}

}

Error response:

{“status”:401,“message”:“Unauthorized api_key”}

I’ve tried regenerating the API key, redeploying the workflow, and using different endpoint formats. The same API key works fine for other workflows, so I’m not sure what’s different about this one.

Any suggestions on what might be causing this? Is there something specific about classification workflows that I might be missing?

Thanks in advance!

Hi @Pritesh_Donga,
Happy to help here! To help me triage, did anything change in your implementation before you began encountering this issue? Also, are you able to run inference on your workflow via the detect.roboflow.com endpoint?

Finally, do you give Roboflow Support permission to access your workspace? Thank you!

Hi @Ford
Thanks for the quick reply. When running inference through detect.roboflow.com endpoint, I get the following error:
Roboflow API HTTP Error: 405 - {“detail”:“Method Not Allowed”}

Yes, I give Roboflow support permission to access the workspace model “phclassifier2”

Additional details of the serverless call:

:link: Calling Roboflow API with image URL: https://firebasestorage.googleapis.com/v0/b/spark-dx-4ed19.appspot.com/o/uxph_images%2Fuxph_1761020243020.jpg?alt=media&token=967df302-b982-4807-8f72-9c0025135d0b

:outbox_tray: API Key: u0u**************
:outbox_tray: Request JSON: {
“api_key”: “us*************** ”,
“inputs”: {
“image”: {“type”: “url”, “value”: “https://firebasestorage.googleapis.com/v0/b/spark-dx-4ed19.appspot.com/o/uxph_images%2Fuxph_1761020243020.jpg?alt=media&token=967df302-b982-4807-8f72-9c0025135d0b”}
}
}
:robot: Roboflow response (HTTP 401): {“status”:401,“message”:“Unauthorized api_key”}