Errors Syncing Environment using PUT /environments

My team currently works on their postman collections & environments stored in an Azure DevOps git repo. I’m currently working on a side project to automatically sync the collections stored in the repo with a postman team workspace.

The idea is basically this:

  1. grab all collections & environments in git
  2. grab all collections & environments in postman workspace (using the GET /workspace API)
  3. match collection in git to collection in workspace
  4. update collection in workspace with git collection
  5. do the same for environments.

I have steps 1-4 working fine, but environments are not working for some reason. I’m always getting a 400 bad request with the following error body:

        "error": {
            "name": "invalidParamsError",
            "message": "The request had invalid parameters",
            "details": {
                "param": "key"

Due to corporate policy I can’t send the entire environment JSON over, but the data I’m sending to Postman in the PUT request seems to be valid according to the API reference. Has anyone seen this before?

  "environment": {
{"key":"testName","value":"10.3-POST-FwRefAgency-BadInputs - Status Code 400","enabled":true},{"key":"version","value":"v1","enabled":true},

I’m also seeing this error and can’t quite figure out the root cause. My goal is to have my monitor re-write some environment variables to iterate a test run so that other requests can use the new values. Here’s a simple version of my PUT request:

  "environment": {
    "values": [
    	{"key": "ownerID", "value": "{{ownerID}}"},
    	{"key": "postmanAPIkey", "value": "{{postmanAPIkey}}"},
    	{"key": "ownerID", "value": "{{ownerID}}"},
    	{"key": "environmentID", "value": "{{environmentID}}"},
    	{"key": "firstName", "value": "{{firstName}}"},
    	{"key": "email", "value": "{{email}}"},
    	{"key": "contactID", "value": "{{contactId}}"},
    	{"key": "externalRequestId", "value": "{{externalRequestId}}"},
    	{"key": "deadline", "value": "{{deadline}}"}