Skip to content

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

Route

Daniel Hougaardf180b5ed6a62
diff --git a/backend/src/server/routes/v2/organization-router.ts b/backend/src/server/routes/v2/organization-router.ts
index ed4a894c54..d2fa7d4502 100644
--- a/backend/src/server/routes/v2/organization-router.ts
+++ b/backend/src/server/routes/v2/organization-router.ts
@@ -46,6 +46,42 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
}
});
+ server.route({
+ method: "GET",
+ url: "/:organizationId/workspaces",
+ schema: {
+ params: z.object({
+ organizationId: z.string().trim()
+ }),
+ response: {
+ 200: z.object({
+ workspaces: z
+ .object({
+ name: z.string(),
+ organization: z.string(),
+ environments: z
+ .object({
+ name: z.string(),
+ slug: z.string()
+ })
+ .array()
+ })
+ .array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.API_KEY, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const workspaces = await server.services.org.findAllWorkspaces({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ orgId: req.params.organizationId
+ });
+
+ return { workspaces };
+ }
+ });
+
server.route({
method: "PATCH",
url: "/:organizationId/memberships/:membershipId",