Interact programmatically with your Vercel account using the SDK or direct HTTP requests.
https://api.vercel.com
and then generally follow the REST architecture. Authorization:Bearer <TOKEN>
https://api.vercel.com/v6/deployments?teamId=[teamID]
Name | Definition | Example |
---|---|---|
ID | A unique value used to identify resources. | "V0fra8eEgQwEpFhYG2vTzC3K" |
String | A string is a sequence of characters used to represent text. | "value" |
Integer | An integer is a number without decimals. | 1234 |
Float | A float is a number with decimals. | 12.34 |
Map | A data structure with a list of values assigned to a unique key. | { "key": "value" } |
List | A data structure with only a list of values separated by a comma. | ["value", 1234, 12.34] |
Enum | An Enum is a String with only a few possible valid values. | A orB |
Date | An Integer representing a date in milliseconds since the UNIX epoch. | 1540095775941 |
IsoDate | A String representing a date in the 8601 format. | YYYY-MM-DDTHH:mm:ssZ |
Boolean | A Boolean is a type of two possible values representing true or false. | true |
limit
when the request is made. The maximum possible value oflimit
is 100.You can then use the pagination object to make additional requests and obtain all the records.The pagination object is structured as shown in the example below:{ "pagination": { "count":20,//Amount of items in the current page. "next":1555072968396,//Timestamp that must be used to request the next page. "prev":1555413045188 //Timestamp that must be used to request the previous page. }}
until
with a value equal to the timestamp value ofnext
returned in the previous requestnext
value ofnull
Node.js
to save all the projects in your personal account to ajson
file:const axios = require('axios');const fs = require('fs');const vercelToken = 'yourtokenvalue';//Replace with your tokenconst apiEndPt = 'https://api.vercel.com/v9/projects';let config = { method: 'get', url: apiEndPt, headers: { Authorization: 'Bearer ' + vercelToken, },};let results = [];(function loop() { axios(config) .then(function (response) { results.push(...response.data.projects); if (response.data.pagination.next !== null) { config.url = `${apiEndPt}?until=${response.data.pagination.next}`; loop(); }else { //you can use the final results object and for example save it to a json file fs.writeFileSync('projects.json',JSON.stringify(results)); } }) .catch(function (error) { console.log(error); });})();
Header | Description |
---|---|
X-RateLimit-Limit | The maximum number of requests that the consumer is permitted to make. |
X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |
X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |
{ "error": { "code":"too_many_requests", "message":"Rate limit exceeded" }}
https://api.vercel.com/v6/deployments`
6
of thedeploymentsendpoint.