Skip to content
Back

Import CSV via API (User Not Authorized)

  • 0
  • 1
  • Databases
  • REST API
LordHaywood
10 Nov, 2025, 15:30

I'm trying to import database data via CSV via API, however getting "The current user is not authorized to perform the requested action." after the API key has "migrations.write" access. (This was erroring/checked prior to adding the permission to the key)

e.g. await client.call("POST", new URL("https://appwrite.domain.com/v1/migrations/csv"), { "content-type": "application/json" }, { bucketId: "dbBootData", fileId: "trees.csv", resourceId: prod:trees, internalFile: true })

TL;DR
To import CSV via API, ensure the user has privileged role like USER_ROLE_OWNER, USER_ROLE_DEVELOPER, or USER_ROLE_ADMIN. To get a node-sdk with this role, turn off "internalFile" in the code located at the specified GitHub link.
LordHaywood
10 Nov, 2025, 15:31

Import CSV via API (User Not Authorized)

LordHaywood
10 Nov, 2025, 15:31

Appwrite 1.8.0 (Self Hosted)

10 Nov, 2025, 16:37

Checking the code, you need isPrivilegedUser aka (USER_ROLE_OWNER, USER_ROLE_DEVELOPER, or USER_ROLE_ADMIN) How can I get a node-sdk to have this role?

https://github.com/appwrite/appwrite/blob/ebee8798550034a33b0f230cf0da0388a405e0d3/app/controllers/api/migrations.php#L343-L346

10 Nov, 2025, 16:42

Turning off "internalFile" made it work

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more