title: Why does the Gmail API return an "invalid to header" error while my API had been working fine for weeks?
body: <p>Using the quickstart guide for the Gmail API with Python, I get an 400 error "Invalid to header" when trying to create a draft.</p>
  
  <p>I have been using my little script for a few weeks and it worked perfectly fine to create invoice drafts in bulk, until one day it just stopped working even though I had not modified any code.</p>
  
  <p>This is the error I get:</p>
  
  <pre><code>   1 file(s) copied.
  Traceback (most recent call last):
  File "quickstart.py", line 223, in &lt;module&gt;
  main()
  File "quickstart.py", line 207, in main
  create_draft(service, 'me', message_body)
  File "quickstart.py", line 134, in create_draft
  draft = service.users().drafts().create(userId=user_id, body=message).execute()
  File "C:\Users\$User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\googleapiclient\_helpers.py", line 130, in positional_wrapper
  return wrapped(*args, **kwargs)
  File "C:\Users\$User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\googleapiclient\http.py", line 842, in execute
  raise HttpError(resp, content, uri=self.uri)
  googleapiclient.errors.HttpError: &lt;HttpError 400 when requesting https://www.googleapis.com/gmail/v1/users/me/drafts?alt=json returned "Invalid to header"&gt;
  </code></pre>
  
  <p>When I got this error for the first time, I deleted the credentials file and downloaded a new one. But now this solution doesn't seem to work anymore.</p>
  
  <p>Does the credentials.json file expire after some time?</p>