You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Vapi API Key can have one of two scopes: Private or Public. The scope of the key will determine the actions that can be performed using the key.
75
+
76
+
For example, it can be used to restrict which API endpoints the key can access.
77
+
26
78
<Note>
27
-
Without the private key, the JWT token's scope will be limited to web call creation.
79
+
As of writing, the only publicly scoped API endpoint is https://api.vapi.ai//call/web, which is used for Web Call creation. All other endpoints are privately scoped.
28
80
</Note>
29
81
30
82
### Example
@@ -35,8 +87,8 @@ const payload = {
35
87
orgId:process.env.ORG_ID,
36
88
};
37
89
38
-
// Get the private key from environment variables
39
-
constkey=process.env.PRIVATE_KEY;
90
+
// Get the private (or public) Vapi API key from environment variables
-**Payload**: The payload includes the `orgId`, representing the organization ID.
53
-
-**Key**: The private key is used to sign the token, ensuring its authenticity.
105
+
-**Key**: The Vapi API key is used to sign the token, ensuring its authenticity.
54
106
-**Options**: The `expiresIn` option specifies that the token will expire in 1 hour.
55
107
-**Token Generation**: The `generateJWT` function (a placeholder for the actual JWT generation method) creates the token using the provided payload, key, and options.
56
108
@@ -94,4 +146,4 @@ With the generated token, you can authenticate API requests to any endpoint requ
94
146
95
147
## Conclusion
96
148
97
-
This documentation covered the basics of generating a JWT token and demonstrated how to use the token to make authenticated API requests. Ensure that your environment variables (e.g., `ORG_ID` and `PRIVATE_KEY`) are correctly set up before running the code.
149
+
This documentation covered the basics of generating a JWT token and demonstrated how to use the token to make authenticated API requests. Ensure that your environment variables (e.g., `ORG_ID` and ``VAPI_API_KEY``) are correctly set up before running the code.
0 commit comments