---
title: "Add Service Accounts To Projects"
method: POST
path: "/organizations/{organizationId}/service-accounts/add-to-project"
tags: ["Project Membership"]
---

# Add Service Accounts To Projects

`POST /organizations/{organizationId}/service-accounts/add-to-project`

## Request

- Base URL: `https://mixpanel.com/api/query`
- URL: `https://mixpanel.com/api/query/organizations/{organizationId}/service-accounts/add-to-project`
- Auth: one of:
  - HTTP basic
  - HTTP basic
- TypeScript: <https://skmtc.dev/mixpanel/apis/query-api/docs/organizations/:organizationId/service-accounts/add-to-project/post.ts> (a function with typed inputs; its response is checked against the schema)

Adds a list of service account ids to a list of project ids with the specified role

## Request body

- AddServiceAccountsToProjectsRequest
  - `projects` object[], required: List of project/roles
    - `id` integer, required: The project id to add the service account to
    - `role` 'owner' | 'admin' | 'analyst' | 'consumer', required: The service account's role
  - `service_account_ids` integer[], required: List of service account ids

## Response `200`

Service accounts added to projects

- object
  - `status` 'ok': "ok" if the request succeeded, "error" otherwise.

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found

---

[API](https://skmtc.dev/mixpanel/apis/query-api.md) - [All operations](https://skmtc.dev/mixpanel/apis/query-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mixpanel/apis/query-api/revisions/f442da95252a?raw)
