Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Complete v1 API reference docs, pre-launch

Tuan Dange2b4adb2e9d8
diff --cc README.md
index 329c862aee,756f65f927..3a3860d2c0
--- a/README.md
+++ b/README.md
@@@ -34,17 -34,17 +34,17 @@@
<img src="/img/infisical_github_repo.png" width="100%" alt="Dashboard" />
- **[Infisical](https://infisical.com)** is an open source, E2EE tool to help teams manage and sync environment variables across their development workflow and infrastructure. It's designed to be simple and take minutes to get going.
+ **[Infisical](https://infisical.com)** is an open source, E2EE tool to help teams manage and sync secrets and configs across their development workflow and infrastructure. It's designed to be simple and take minutes to get going.
- - **[User-Friendly Dashboard](https://infisical.com/docs/getting-started/dashboard/project)** to manage your team's environment variables within projects
- - **[Language-Agnostic CLI](https://infisical.com/docs/cli/overview)** that pulls and injects environment variables into your local workflow
+ - **[User-Friendly Dashboard](https://infisical.com/docs/getting-started/dashboard/project)** to manage your team's secrets and configs within projects
+ - **[Language-Agnostic CLI](https://infisical.com/docs/cli/overview)** that pulls and injects esecrets and configs into your local workflow
- **[Complete control over your data](https://infisical.com/docs/self-hosting/overview)** - host it yourself on any infrastructure
- **Navigate Multiple Environments** per project (e.g. development, staging, production, etc.)
- - **Personal overrides** for environment variables
+ - **Personal overrides** for secrets and configs
- **[Integrations](https://infisical.com/docs/integrations/overview)** with CI/CD and production infrastructure
-- **[Secret Versioning](https://infisical.com/docs/getting-started/dashboard/versioning)** - check the history of change for any secret
-- **[Activity Logs](https://infisical.com/docs/getting-started/dashboard/audit-logs)** - check what user in the project is performing what actions with secrets
-- **[Point-in-time Secrets Recovery](https://infisical.com/docs/getting-started/dashboard/pit-recovery)** - roll back to any snapshot of you secrets
+- **[Secret Versioning](https://infisical.com/docs/getting-started/dashboard/versioning)** to view the change history for any secret
+- **[Activity Logs](https://infisical.com/docs/getting-started/dashboard/audit-logs)** to record every action taken in a project.
+- **[Point-in-time Secrets Recovery](https://infisical.com/docs/getting-started/dashboard/pit-recovery)** for rolling back to any snapshot of your secrets
- πŸ”œ **1-Click Deploy** to Digital Ocean and Heroku
- πŸ”œ **Authentication/Authorization** for projects (read/write controls soon)
- πŸ”œ **Automatic Secret Rotation**
diff --cc backend/src/app.ts
index 8cefd31ac2,82275b9c9e..d32e83be77
--- a/backend/src/app.ts
+++ b/backend/src/app.ts
@@@ -104,7 -104,7 +105,8 @@@ app.use('/api/v1/integration', v1Integr
app.use('/api/v1/integration-auth', v1IntegrationAuthRouter);
// v2 routes
+app.use('/api/v2/users', v2UsersRouter);
+ app.use('/api/v2/workspace', v2EnvironmentRouter);
app.use('/api/v2/workspace', v2WorkspaceRouter); // TODO: turn into plural route
app.use('/api/v2/secret', v2SecretRouter); // stop supporting, TODO: revise
app.use('/api/v2/secrets', v2SecretsRouter);
diff --cc backend/src/controllers/v2/index.ts
index bc68485901,601314a2ad..b2b245d9cc
--- a/backend/src/controllers/v2/index.ts
+++ b/backend/src/controllers/v2/index.ts
@@@ -4,9 -3,9 +4,10 @@@ import * as serviceTokenDataController
import * as apiKeyDataController from './apiKeyDataController';
import * as secretController from './secretController';
import * as secretsController from './secretsController';
+ import * as environmentController from './environmentController';
export {
+ usersController,
workspaceController,
serviceTokenDataController,
apiKeyDataController,
diff --cc backend/src/controllers/v2/secretsController.ts
index 43434df63a,098cfed6d0..77a318fc64
--- a/backend/src/controllers/v2/secretsController.ts
+++ b/backend/src/controllers/v2/secretsController.ts
@@@ -21,61 -23,9 +23,61 @@@ import { BadRequestError } from '../../
* @param res
*/
export const createSecrets = async (req: Request, res: Response) => {
+ /*
+ #swagger.summary = 'Create new secret(s)'
+ #swagger.description = 'Create one or many secrets for a given project and environment.'
+
+ #swagger.security = [{
+ "apiKeyAuth": []
+ }]
+
+ #swagger.requestBody = {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "workspaceId": {
+ "type": "string",
+ "description": "ID of project",
+ },
+ "environment": {
+ "type": "string",
+ "description": "Environment within project"
+ },
+ "secrets": {
+ $ref: "#/components/schemas/CreateSecret",
+ "description": "Secret(s) to create - object or array of objects"
+ }
+ }
+ }
+ }
+ }
+ }
+
+ #swagger.responses[200] = {
+ content: {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secrets": {
+ "type": "array",
+ "items": {
+ $ref: "#/components/schemas/Secret"
+ },
+ "description": "Newly-created secrets for the given project and environment"
+ }
+ }
+ }
+ }
+ }
+ }
+ */
- const channel = req.headers?.['user-agent']?.toLowerCase().includes('mozilla') ? 'web' : 'cli';
+ const channel = req.headers?.['user-agent']?.toLowerCase().includes('mozilla') ? 'web' : 'cli';
const { workspaceId, environment } = req.body;
-
+
let toAdd;
if (Array.isArray(req.body.secrets)) {
// case: create multiple secrets
@@@ -202,50 -161,13 +213,52 @@@
* @returns
*/
export const getSecrets = async (req: Request, res: Response) => {
+ /*
+ #swagger.summary = 'Read secrets'
+ #swagger.description = 'Read secrets from a project and environment'
+
+ #swagger.security = [{
+ "apiKeyAuth": []
+ }]
+
+ #swagger.parameters['workspaceId'] = {
+ "description": "ID of project",
+ "required": true,
+ "type": "string"
+ }
+
+ #swagger.parameters['environment'] = {
+ "description": "Environment within project",
+ "required": true,
+ "type": "string"
+ }
+
+ #swagger.responses[200] = {
+ content: {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secrets": {
+ "type": "array",
+ "items": {
+ $ref: "#/components/schemas/Secret"
+ },
+ "description": "Secrets for the given project and environment"
+ }
+ }
+ }
+ }
+ }
+ }
+ */
const { workspaceId, environment } = req.query;
-
+
let userId: Types.ObjectId | undefined = undefined // used for getting personal secrets for user
+ let userEmail: Types.ObjectId | undefined = undefined // used for posthog
if (req.user) {
userId = req.user._id;
+ userEmail = req.user.email;
}
if (req.serviceTokenData) {
@@@ -308,52 -231,8 +322,52 @@@
* @param res
*/
export const updateSecrets = async (req: Request, res: Response) => {
+ /*
+ #swagger.summary = 'Update secret(s)'
+ #swagger.description = 'Update secret(s)'
+
+ #swagger.security = [{
+ "apiKeyAuth": []
+ }]
+
+ #swagger.requestBody = {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secrets": {
+ $ref: "#/components/schemas/UpdateSecret",
+ "description": "Secret(s) to update - object or array of objects"
+ }
+ }
+ }
+ }
+ }
+ }
+
+ #swagger.responses[200] = {
+ content: {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secrets": {
+ "type": "array",
+ "items": {
+ $ref: "#/components/schemas/Secret"
+ },
+ "description": "Updated secrets"
+ }
+ }
+ }
+ }
+ }
+ }
+ */
- const channel = req.headers?.['user-agent']?.toLowerCase().includes('mozilla') ? 'web' : 'cli';
-
+ const channel = req.headers?.['user-agent']?.toLowerCase().includes('mozilla') ? 'web' : 'cli';
+
// TODO: move type
interface PatchSecret {
id: string;
@@@ -519,53 -403,9 +538,53 @@@
* @param res
*/
export const deleteSecrets = async (req: Request, res: Response) => {
+ /*
+ #swagger.summary = 'Delete secret(s)'
+ #swagger.description = 'Delete one or many secrets by their ID(s)'
+
+ #swagger.security = [{
+ "apiKeyAuth": []
+ }]
+
+ #swagger.requestBody = {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secretIds": {
+ "type": "string",
+ "description": "ID(s) of secrets - string or array of strings"
+ },
+ }
+ }
+ }
+ }
+ }
+
+ #swagger.responses[200] = {
+ content: {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secrets": {
+ "type": "array",
+ "items": {
+ $ref: "#/components/schemas/Secret"
+ },
+ "description": "Deleted secrets"
+ }
+ }
+ }
+ }
+ }
+ }
+ */
- const channel = req.headers?.['user-agent']?.toLowerCase().includes('mozilla') ? 'web' : 'cli';
+ const channel = req.headers?.['user-agent']?.toLowerCase().includes('mozilla') ? 'web' : 'cli';
const toDelete = req.secrets.map((s: any) => s._id);
-
+
await Secret.deleteMany({
_id: {
$in: toDelete
diff --cc backend/src/routes/v2/index.ts
index a30c72642a,2740c35304..cc9375fb72
--- a/backend/src/routes/v2/index.ts
+++ b/backend/src/routes/v2/index.ts
@@@ -4,9 -3,9 +4,10 @@@ import secrets from './secrets'
import workspace from './workspace';
import serviceTokenData from './serviceTokenData';
import apiKeyData from './apiKeyData';
+ import environment from "./environment"
export {
+ users,
secret,
secrets,
workspace,