error 403 storageQuotaExceeded when the service account's drive is completely empty

got a 403 http error when copy-ing an existing google slides using a drive API. i’m using a service account, and it’s already shared towards it. here’s the error response

“The user’s Drive storage quota has been exceeded.”. Details: "[{‘message’: “The user’s Drive storage quota has been exceeded.”, ‘domain’: ‘usageLimits’, ‘reason’: ‘storageQuotaExceeded’}]"​
when i check the drive quota using the API as well, it returns nothing

{‘storageQuota’: {‘limit’: ‘0’, ‘usage’: ‘0’, ‘usageInDrive’: ‘0’, ‘usageInDriveTrash’: ‘0’}}​
i also have tried copying the files into my own folder (ofcourse already shared to the service account) but still got the same error

Hi @rdhofdlh,

Welcome to Google Developer Program Forum.

This error occurs when the user reaches their storage limit. Service accounts don’t have storage quota and can’t own any files. Instead, you must upload files and folders into shared drives, or use OAuth 2.0 to upload items on behalf of a human user.

For more detailed guidance, please contact Google Workspace support.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Solved the same problem (service account with normal shared folder):

  • Create a shared drive (see drive.google.com => [left menu] shared drives
  • Share it with the service account (xxxx@xxxx.iam.gserviceaccount.com)
  • Create a folder in it, go to it and get its id from the URL
  • In any API actions (like drive.file.create(..)) set flag supportAllDrives: true
  • And in those API action calls use that folder id in resource entry: { resource : { …, [‘<<folder_id>>’] , fields: …. } etc

Hope that helps.