Skip to content

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.

Endpoint Summary

MethodPathDescriptionNotes
GET/api/v2/organization/Fetch the active organization attached to the current token or sessionSee Get Current Organization.
PUT/api/v2/organization/Update organization profile fieldsSee 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/json

Response

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

  1. The organization is resolved by middleware. Applications embedding the slug in the URL must still pass the appropriate access token.
  2. Fields such as allow_join and allow_search reflect 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"
}
FieldTypeRequiredDescription
namestringNoDisplay name shown across the portal
descriptionstringNoRicher context for operators. Markdown is not rendered.

Response

Returns the same schema as Get Current Organization with updated timestamps and values.

Error Codes

StatusCodeDescription
401UNAUTHORIZEDMissing or invalid credentials
403FORBIDDENCaller is not the organization owner
400BAD_REQUESTValidation failure (e.g., name too long)
  • 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.