Search code examples
pythonsendgridsendgrid-api-v2

Permission denied at Customer Subuser API


I'm trying to manage subuser account limits via SendGrid Web API v2, but I keep getting:

{u'error': {
    u'message': u'Permission denied, not allowed to manage users',
    u'code': 401
}}

What I'm doing is to POST at https://api.sendgrid.com/apiv2/customer.limit.json with DATA: api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username&task=retrieve just like the docs suggest.

requests.post('https://api.sendgrid.com/apiv2/customer.limit.json',
    data={'api_user': 'my_sg_username',
          'api_key': 'my_sg_password',
          'user': 'subuser_username',
          'task': 'retrieve'
    }).json()

My account has Admin permissions and I am able do changes via the UI, but not with v2 of the API.

Is there any option somewhere which I'm missing?

Few Notes:

  • I'm able to create subusers with v3 of the API
  • But I'm using v2 here, because there is no account limits options in v3.
  • I get this error on all apiv2/customer.*.* endpoints, thus I cannot follow this guide

Solution

  • I am also facing the same problem. I have contacted customer support. They say that there is a v3 endpoint and is not documented. Am waiting for their reply on this. Will update this thread once I get reply from send