---
title: retrieve-the-environment-variables-of-a-project-by-id-or-name
product: vercel
url: /docs/rest-api/projects/retrieve-the-environment-variables-of-a-project-by-id-or-name
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about retrieve-the-environment-variables-of-a-project-by-id-or-name on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Retrieve the environment variables of a project by id or name

```http
GET /v10/projects/{idOrName}/env
```

Retrieve the environment variables for a given project by passing either the project `id` or `name` in the URL.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `idOrName` | string | Yes | The unique project identifier or the project name |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `gitBranch` | string. maxLength: 250 | No | If defined, the git branch of the environment variable to filter the results (must have target=preview) |
| `decrypt` | string. enum: true, false | No | If true, the environment variable value will be decrypted |
| `source` | string | No | The source that is calling the endpoint. |
| `customEnvironmentId` | string | No | The unique custom environment identifier within the project |
| `customEnvironmentSlug` | string | No | The custom environment slug (name) within the project |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Responses

### 200: The list of environment variables for the given project

Content-Type: `application/json`

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "key",
        "type",
        "value"
      ],
      "properties": {
        "target": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "production",
                  "preview",
                  "development",
                  "preview",
                  "development"
                ]
              }
            },
            {
              "type": "string",
              "enum": [
                "production",
                "preview",
                "development",
                "preview",
                "development"
              ]
            }
          ]
        },
        "type": {
          "type": "string",
          "enum": [
            "secret",
            "system",
            "encrypted",
            "plain",
            "sensitive"
          ]
        },
        "sunsetSecretId": {
          "type": "string",
          "description": "This is used to identify variables that have been migrated from type secret to sensitive."
        },
        "legacyValue": {
          "type": "string",
          "description": "Legacy now-encryption ciphertext, present after migration swaps value/vsmValue"
        },
        "decrypted": {
          "type": "boolean",
          "enum": [
            false,
            true
          ]
        },
        "value": {
          "type": "string"
        },
        "vsmValue": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "key": {
          "type": "string"
        },
        "configurationId": {
          "type": "string",
          "nullable": true
        },
        "createdAt": {
          "type": "number"
        },
        "updatedAt": {
          "type": "number"
        },
        "createdBy": {
          "type": "string",
          "nullable": true
        },
        "updatedBy": {
          "type": "string",
          "nullable": true
        },
        "gitBranch": {
          "type": "string"
        },
        "edgeConfigId": {
          "type": "string",
          "nullable": true
        },
        "edgeConfigTokenId": {
          "type": "string",
          "nullable": true
        },
        "contentHint": {
          "nullable": true,
          "oneOf": [
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "redis-url"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "redis-rest-api-url"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "redis-rest-api-token"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "redis-rest-api-read-only-token"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "blob-read-write-token"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-url"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-url-non-pooling"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-prisma-url"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-user"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-host"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-password"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-database"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "postgres-url-no-ssl"
                  ]
                },
                "storeId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "integrationConfigurationId",
                "integrationId",
                "integrationProductId",
                "storeId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "integration-store-secret"
                  ]
                },
                "storeId": {
                  "type": "string"
                },
                "integrationId": {
                  "type": "string"
                },
                "integrationProductId": {
                  "type": "string"
                },
                "integrationConfigurationId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "projectId",
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "flags-connection-string"
                  ]
                },
                "projectId": {
                  "type": "string"
                }
              }
            }
          ]
        },
        "internalContentHint": {
          "type": "object",
          "description": "Similar to `contentHints`, but should not be exposed to the user.",
          "nullable": true,
          "required": [
            "encryptedValue",
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "flags-secret"
              ]
            },
            "encryptedValue": {
              "type": "string",
              "description": "Contains the `value` of the env variable, encrypted with a special key to make decryption possible in the subscriber Lambda."
            }
          }
        },
        "comment": {
          "type": "string"
        },
        "customEnvironmentIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "system": {
          "type": "boolean",
          "enum": [
            false,
            true
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "envs",
        "pagination"
      ],
      "properties": {
        "envs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "key",
              "type",
              "value"
            ],
            "properties": {
              "target": {
                "oneOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "production",
                        "preview",
                        "development",
                        "preview",
                        "development"
                      ]
                    }
                  },
                  {
                    "type": "string",
                    "enum": [
                      "production",
                      "preview",
                      "development",
                      "preview",
                      "development"
                    ]
                  }
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "secret",
                  "system",
                  "encrypted",
                  "plain",
                  "sensitive"
                ]
              },
              "sunsetSecretId": {
                "type": "string",
                "description": "This is used to identify variables that have been migrated from type secret to sensitive."
              },
              "legacyValue": {
                "type": "string",
                "description": "Legacy now-encryption ciphertext, present after migration swaps value/vsmValue"
              },
              "decrypted": {
                "type": "boolean",
                "enum": [
                  false,
                  true
                ]
              },
              "value": {
                "type": "string"
              },
              "vsmValue": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "key": {
                "type": "string"
              },
              "configurationId": {
                "type": "string",
                "nullable": true
              },
              "createdAt": {
                "type": "number"
              },
              "updatedAt": {
                "type": "number"
              },
              "createdBy": {
                "type": "string",
                "nullable": true
              },
              "updatedBy": {
                "type": "string",
                "nullable": true
              },
              "gitBranch": {
                "type": "string"
              },
              "edgeConfigId": {
                "type": "string",
                "nullable": true
              },
              "edgeConfigTokenId": {
                "type": "string",
                "nullable": true
              },
              "contentHint": {
                "nullable": true,
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-rest-api-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-rest-api-token"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-rest-api-read-only-token"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "blob-read-write-token"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-url-non-pooling"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-prisma-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-user"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-host"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-password"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-database"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-url-no-ssl"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "integrationConfigurationId",
                      "integrationId",
                      "integrationProductId",
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "integration-store-secret"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      },
                      "integrationId": {
                        "type": "string"
                      },
                      "integrationProductId": {
                        "type": "string"
                      },
                      "integrationConfigurationId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "projectId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "flags-connection-string"
                        ]
                      },
                      "projectId": {
                        "type": "string"
                      }
                    }
                  }
                ]
              },
              "internalContentHint": {
                "type": "object",
                "description": "Similar to `contentHints`, but should not be exposed to the user.",
                "nullable": true,
                "required": [
                  "encryptedValue",
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "flags-secret"
                    ]
                  },
                  "encryptedValue": {
                    "type": "string",
                    "description": "Contains the `value` of the env variable, encrypted with a special key to make decryption possible in the subscriber Lambda."
                  }
                }
              },
              "comment": {
                "type": "string"
              },
              "customEnvironmentIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "system": {
                "type": "boolean",
                "enum": [
                  false,
                  true
                ]
              }
            }
          }
        },
        "pagination": {
          "type": "object",
          "description": "This object contains information related to the pagination of the current request, including the necessary parameters to get the next or previous page of data.",
          "required": [
            "count",
            "next",
            "prev"
          ],
          "properties": {
            "count": {
              "type": "number",
              "description": "Amount of items in the current page."
            },
            "next": {
              "type": "number",
              "description": "Timestamp that must be used to request the next page.",
              "nullable": true
            },
            "prev": {
              "type": "number",
              "description": "Timestamp that must be used to request the previous page.",
              "nullable": true
            }
          }
        }
      }
    },
    {
      "type": "object",
      "description": "The list of environment variables for the given project",
      "required": [
        "envs"
      ],
      "properties": {
        "envs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "key",
              "type",
              "value"
            ],
            "properties": {
              "target": {
                "oneOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "production",
                        "preview",
                        "development",
                        "preview",
                        "development"
                      ]
                    }
                  },
                  {
                    "type": "string",
                    "enum": [
                      "production",
                      "preview",
                      "development",
                      "preview",
                      "development"
                    ]
                  }
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "secret",
                  "system",
                  "encrypted",
                  "plain",
                  "sensitive"
                ]
              },
              "sunsetSecretId": {
                "type": "string",
                "description": "This is used to identify variables that have been migrated from type secret to sensitive."
              },
              "legacyValue": {
                "type": "string",
                "description": "Legacy now-encryption ciphertext, present after migration swaps value/vsmValue"
              },
              "decrypted": {
                "type": "boolean",
                "enum": [
                  false,
                  true
                ]
              },
              "value": {
                "type": "string"
              },
              "vsmValue": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "key": {
                "type": "string"
              },
              "configurationId": {
                "type": "string",
                "nullable": true
              },
              "createdAt": {
                "type": "number"
              },
              "updatedAt": {
                "type": "number"
              },
              "createdBy": {
                "type": "string",
                "nullable": true
              },
              "updatedBy": {
                "type": "string",
                "nullable": true
              },
              "gitBranch": {
                "type": "string"
              },
              "edgeConfigId": {
                "type": "string",
                "nullable": true
              },
              "edgeConfigTokenId": {
                "type": "string",
                "nullable": true
              },
              "contentHint": {
                "nullable": true,
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-rest-api-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-rest-api-token"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "redis-rest-api-read-only-token"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "blob-read-write-token"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-url-non-pooling"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-prisma-url"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-user"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-host"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-password"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-database"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "postgres-url-no-ssl"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "integrationConfigurationId",
                      "integrationId",
                      "integrationProductId",
                      "storeId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "integration-store-secret"
                        ]
                      },
                      "storeId": {
                        "type": "string"
                      },
                      "integrationId": {
                        "type": "string"
                      },
                      "integrationProductId": {
                        "type": "string"
                      },
                      "integrationConfigurationId": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "projectId",
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "flags-connection-string"
                        ]
                      },
                      "projectId": {
                        "type": "string"
                      }
                    }
                  }
                ]
              },
              "internalContentHint": {
                "type": "object",
                "description": "Similar to `contentHints`, but should not be exposed to the user.",
                "nullable": true,
                "required": [
                  "encryptedValue",
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "flags-secret"
                    ]
                  },
                  "encryptedValue": {
                    "type": "string",
                    "description": "Contains the `value` of the env variable, encrypted with a special key to make decryption possible in the subscriber Lambda."
                  }
                }
              },
              "comment": {
                "type": "string"
              },
              "customEnvironmentIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "system": {
                "type": "boolean",
                "enum": [
                  false,
                  true
                ]
              }
            }
          }
        }
      }
    }
  ]
}
```

### 400: One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 403: You do not have permission to access this resource.

---

## Related

- [projects endpoints](/docs/rest-api#projects)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
