# Repository · Organizations

Part of AppEngine API Documentation. Full index: https://appengine.appmint.io/documentation.md
## GET /repository/org/{orgid}

**Get an organization**

`operationId: RepositoryController_getOrg`

Fetches one organization by id. The org is a **path parameter**, not the `orgid` header, because this reads an org other than the caller's own — which is why it is root-only.

#### Signature

```http
GET /repository/org/{orgid} (orgid: string, enrich?: boolean) -> The organization
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootUser`, `RootSystem`, `RootAdmin`, `ConfigAdmin`.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `GET /repository/org-by-hostname/{hostname}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | path | string | yes | Organization id to read. |
| `enrich` | query | boolean | — | Resolve linked records inline. |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | The organization |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## GET /repository/org-by-hostname/{hostname}

**Get an organization by hostname**

`operationId: RepositoryController_getOrgIdByDomainName`

Resolves an organization from a domain name — how a multi-tenant front end works out which org a request belongs to before it has an `orgid` to send.

#### Signature

```http
GET /repository/org-by-hostname/{hostname} (hostname: string, enrich?: boolean) -> The organization owning that hostname
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootUser`, `RootSystem`, `RootAdmin`, `ConfigAdmin`.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `GET /repository/org/{orgid}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain name to resolve. |
| `enrich` | query | boolean | — |  |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | The organization owning that hostname |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## GET /repository/org

**Query organizations**

`operationId: RepositoryController_queryOrg`

Lists organizations across the platform. **Root-level access only** — this crosses tenant boundaries and is not scoped to a single org.

#### Signature

```http
GET /repository/org (keyword?: string, fields?: boolean) -> Matching organizations
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootUser`, `RootSystem`, `RootAdmin`.

#### Notes

- Cross-tenant. Restrict who holds root roles accordingly.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `GET /repository/org/{orgid}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `keyword` | query | string | — | Search text. |
| `fields` | query | boolean | — | Include full field detail rather than a summary. |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | Matching organizations |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## POST /repository/org/update/{orgid}

**Update an organization**

`operationId: RepositoryController_updateOrg`

Updates an organization's settings. Root-level: it can target any org, not just the caller's.

#### Signature

```http
POST /repository/org/update/{orgid} (orgid: string, body) -> The updated organization
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootSystem`, `RootAdmin`, `RootPowerUser`.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `DELETE /repository/org/delete/{orgid}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | path | string | yes | Organization to update. |

### Request body

Fields to change.

```json
{
  "title": "Acme Retail (EMEA)"
}
```

### Responses

| Status | Meaning |
| --- | --- |
| `201` | The updated organization |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## POST /repository/org/create

**Create an organization**

`operationId: RepositoryController_createOrg`

Provisions a new organization — a tenant-level operation restricted to root roles.

#### Signature

```http
POST /repository/org/create (body) -> The created organization
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootSystem`, `RootAdmin`, `RootPowerUser`.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `POST /repository/org/update/{orgid}`

### Request body

The organization to create.

```json
{
  "name": "acme-retail",
  "title": "Acme Retail",
  "hostname": "shop.example.com"
}
```

### Responses

| Status | Meaning |
| --- | --- |
| `201` | The created organization |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## DELETE /repository/org/delete/{orgid}

**Delete an organization**

`operationId: RepositoryController_deleteOrg`

Deletes an entire organization. This is the most destructive operation on the platform — it removes a whole tenant — and is restricted to `RootAdmin` alone, a narrower role than any other endpoint here.

There is no confirmation step and no undo.

#### Signature

```http
DELETE /repository/org/delete/{orgid} (orgid: string) -> Deletion result
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootAdmin`.

#### Notes

- Irreversible, and removes an entire tenant's data. `RootAdmin` only.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `POST /repository/org/update/{orgid}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | path | string | yes | Organization to delete. |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | Deletion result |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## GET /repository/org/user/{email}

**Get a user's organizations**

`operationId: RepositoryController_getUserOrg`

Lists the organizations a user belongs to — how a sign-in flow offers an org picker to someone who is a member of several.

**This route is public**, so it discloses which organizations a given email address belongs to without authentication. Rate-limit anything built on it.

#### Signature

```http
GET /repository/org/user/{email} (email: string) -> Organizations the user belongs to
```

#### Access

Public — no credentials required. Required role(s): `User`.

#### Notes

- Unauthenticated — it confirms both that an account exists and where it has access.

#### Errors

Plus the standard platform errors: `429`, `500`.

#### See also

- `DELETE /repository/org/user/{email}:/{orgid}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | path | string | yes | The user's email address. |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | Organizations the user belongs to |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## POST /repository/org/query/{datatype}

**Query data across organizations**

`operationId: RepositoryController_queryOrgData`

Runs a query against a datatype at root level. Restricted to root roles because it is the cross-tenant form of the ordinary repository query.

#### Signature

```http
POST /repository/org/query/{datatype} (datatype: string, body) -> Matching records
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`). Required role(s): `RootAdmin`, `RootUser`, `RootPowerUser`, `RootSystem`.

#### Notes

- Root-scoped. Verify the tenant boundary before exposing results to a user.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `POST /repository/find/{datatype}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgid` | header | string | yes | Organization (tenant) identifier. Every request is scoped to this org; data from other orgs is never visible. Issued with your API credentials. |
| `datatype` | path | string | yes | The collection to act on. |

### Request body

The query to run.

```json
{
  "query": {
    "data.status": "active"
  },
  "page": 1,
  "pageSize": 50
}
```

### Responses

| Status | Meaning |
| --- | --- |
| `201` | Matching records |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

## DELETE /repository/org/user/{email}:/{orgid}

**Remove a user from an organization**

`operationId: RepositoryController_deleteUserOrg`

Removes a user's membership of an organization.

**The route path is malformed.** It is declared as `org/user/:email:/:orgid` — with a stray colon after `:email` — so the URL requires a literal `:` between the email and the org id, giving `/repository/org/user/ada@example.com:/acme-retail`. That is almost certainly a typo for `org/user/:email/:orgid`; treat the endpoint as unstable and expect the path to change.

#### Signature

```http
DELETE /repository/org/user/{email}:/{orgid} (email: string, orgid: string) -> Removal result
```

#### Access

Requires a bearer JWT (`Authorization: Bearer <token>`).

#### Notes

- The literal `:` in the path is a defect in the route declaration, not a deliberate separator.
- Unlike the other org routes, this one declares no role restriction.

#### Errors

Plus the standard platform errors: `401`, `403`, `429`, `500`.

#### See also

- `GET /repository/org/user/{email}`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | path | string | yes | The user's email address. A literal `:` must follow it in the URL. |
| `orgid` | path | string | yes | Organization to remove them from. |

### Responses

| Status | Meaning |
| --- | --- |
| `200` | Removal result |
| `401` | Authentication failed: Invalid or expired token — The `Authorization` header is missing, malformed, or the JWT has expired. |
| `403` | You do not have permission to perform this action — The caller is authenticated but lacks the role required by the endpoint, or is acting on another org. |
| `429` | Too Many Requests — More than 100,000 requests from one IP within 5 minutes (configurable per deployment). CORS preflights and requests from inside the platform cluster are not counted. The limiter answers before the error filter, so the body is `{ statusCode, error, message }` with no `path`, `method` or `timeStamp`; the `RateLimit-*` response headers say when the window resets. |
| `500` | An unexpected error occurred. Our team has been notified. — An unhandled server-side failure. |

