Create an Auth Token
POST
https://api.vercel.com/v3/user/tokensCreates and returns a new authentication token for the currently authenticated User. The
bearerToken property is only provided once, in the response body, so be sure to save it on the client for use with API requests.https://api.vercel.com/v3/user/tokens
const response = await fetch('https://api.vercel.com/v3/user/tokens?teamId=string&slug=string', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ "name": "Example Name", "expiresAt": "123", "projectId": "example_id" }),});
const data = await response.json();console.log(data);Response
{ "bearerToken": "uRKJSTt0L4RaSkiMj41QTkxM", "token": { "activeAt": "1632816536002", "createdAt": "1632816536002", "expiresAt": "1632816536002", "id": "5d9f2ebd38ddca62e5d51e9c1704c72530bdc8bfdd41e782a6687c48399e8391", "leakedAt": "1632816536002", "leakedUrl": "https://example.com", "name": "Example Name", "origin": "github", "prefix": "vcp_", "revokedAt": "1632816536002", "scopes": [ { "createdAt": "123", "expiresAt": "123", "origin": "app", "sudo": { "expiresAt": "123", "origin": "email-otp", "verifiedAt": "123" }, "type": "user" } ], "suffix": "abc123", "type": "oauth2-token" }}AuthorizationbearerToken
Default authentication mechanism
400One of the provided values in the request body is invalid.
401The request is not authorized.
403You do not have permission to access this resource.
404Error
410Error