Ana içeriğe geç

Create Credential Organization

Endpoint

POST /apiops/projects/{projectName}/credential-organizations/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name

Request Body

Full JSON Body Example

{
"code": "team-alpha",
"nameDefault": "Team Alpha",
"nameSecondary": "Alpha Ekibi",
"parentOrganizationCode": "root-org",
"metadata": [
{
"key": "costCenter",
"value": "CC-1001",
"secret": false,
"includeInJwt": true,
"includeInTokenResponse": false,
"jwtClaimName": null
}
]
}

Request Body Fields

FieldTypeRequiredDefaultDescription
codestringYes-Stable public identifier (unique within the project)
nameDefaultstringNo-Primary display name
nameSecondarystringNo-Secondary display name
parentOrganizationCodestringNo-Parent organization code (must exist in the same project)
metadataarray[object]No[]Custom metadata entries. See Metadata Object below
defaultLimitPlansarray[object]No-Default limit plan per family for consumers created under the organization from then on: [{ "family": "REQUEST_RATE" | "AI_TOKEN_BUDGET", "planKey": "<published plan key>", "scope": "PROJECT" | "PLATFORM" }]. The plan must be published and belong to the project or the platform catalog. scope is optional: given, planKey must be an exact match in that catalog only; omitted, resolution falls back to the project catalog first, then the platform catalog. Omit the whole field to set none.

Metadata Object

FieldTypeRequiredDefaultDescription
keystringYes-Metadata key
valuestringNo-Metadata value. Secret entries are write-only on GET
secretbooleanNofalseWhen true, the value is not returned on GET
includeInJwtbooleanNofalseInclude this entry in issued JWT access tokens
includeInTokenResponsebooleanNofalseInclude this entry in token endpoint JSON responses
jwtClaimNamestring|nullNonullOverride JWT claim name; defaults to key when null

Response

Success Response (201 Created)

Returns the created CredentialOrganizationDTO. Secret metadata values are omitted from the response body.

{
"code": "team-alpha",
"nameDefault": "Team Alpha",
"nameSecondary": "Alpha Ekibi",
"parentOrganizationCode": "root-org",
"metadata": [
{
"key": "costCenter",
"value": "CC-1001",
"secret": false,
"includeInJwt": true,
"includeInTokenResponse": false,
"jwtClaimName": null
}
]
}

Error Responses

StatusCondition
400Blank code, parent organization not found, or invalid defaultLimitPlans entry (see Notes)
401Invalid or missing token
409An organization with the same code already exists in the project
500Unexpected server error

cURL Example

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/credential-organizations/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"code": "team-alpha", "nameDefault": "Team Alpha", "metadata": []}'

Notes and Warnings

  • code is immutable. After creation, the organization is always addressed by code in path parameters.
  • Metadata replaces the full list on update. On POST, an empty or omitted metadata array creates the organization with no metadata entries.
  • Secret metadata is write-only. Values marked secret: true are never returned on GET; supply the value again on POST/PUT to set or change it.
  • defaultLimitPlans applies to new consumers only. Existing consumers keep their assignments; use the Limit Plans bulk assignment for them. A planKey that is not published, belongs to another family, or is not visible to the project returns 400 (limit.orgDefault.planNotPublished, limit.orgDefault.planFamilyMismatch, limit.orgDefault.planNotFound). An unrecognized scope (anything other than PROJECT or PLATFORM) returns 400 (limit.orgDefault.scopeInvalid) — a typo does not silently fall back to searching both catalogs.

Permissions

User must have IDENTITY + MANAGE permission in the project.