Appearance
Organization Management
Overview
Organization endpoints expose the tenant that scopes every device, project, and token. Use these APIs to read metadata about the active organization or rename it. Token creation, membership management, and access configuration are documented in the dedicated guides referenced below.
- Base Path:
/api/v2/organization/ - Related Guides: Organization Tokens
Endpoint Summary
| Method | Path | Description | Notes |
|---|---|---|---|
| GET | /api/v2/organization/ | Fetch the active organization attached to the current token or session | See Get Current Organization. |
| PUT | /api/v2/organization/ | Update organization profile fields | See Update Organization. |
Endpoints
Get Current Organization
Retrieve metadata for the organization resolved from the request context.
Request
http
GET /api/v2/organization/
Authorization: Bearer <token>
Content-Type: application/jsonResponse
json
{
"id": "org_3f2bb6",
"slug": "yanji-lab",
"name": "Yanji Lab",
"description": "Pilot installation for greenhouse monitoring",
"allow_join": true,
"allow_search": false,
"is_active": true,
"created_at": "2024-01-08T10:00:00Z",
"updated_at": "2024-02-16T09:00:00Z",
"creator": {
"id": "user_12",
"username": "ops@yanjiiot.com"
}
}Notes
- The organization is resolved by middleware. Applications embedding the slug in the URL must still pass the appropriate access token.
- Fields such as
allow_joinandallow_searchreflect on-boarding policies enforced by the console.
Update Organization
Update mutable metadata for the active organization. Only the creator (owner) can call this endpoint.
Request
http
PUT /api/v2/organization/
Authorization: Bearer <owner_token>
Content-Type: application/json
{
"name": "Yanji Smart Agriculture",
"description": "Central tenant for greenhouse and cold-chain projects"
}| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Display name shown across the portal |
description | string | No | Richer context for operators. Markdown is not rendered. |
Response
Returns the same schema as Get Current Organization with updated timestamps and values.
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid credentials |
| 403 | FORBIDDEN | Caller is not the organization owner |
| 400 | BAD_REQUEST | Validation failure (e.g., name too long) |
Related Topics
- Membership management, slug changes, and deletion are handled by Yanji IoT Cloud support. Reach out via the support channel if you need those workflows.
- Token lifecycle operations are covered in Organization Token Management.
