Member types
The kinds of member you define for the environment (people, bots, automations), each with a cap per member each calendar month and the models it may use.
| Operation | Method | SDK |
|---|---|---|
| List member types | GET | hixel.memberTypes.list |
| Create or replace a member type | PUT | hixel.memberTypes.put |
| Remove a member type | DELETE | hixel.memberTypes.remove |
List member types#
Every member type of the environment, by key; member is always among them, with no cap and no models while you have not set them.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Response 200: MemberTypeList
| Field | Type | Description |
|---|---|---|
data required | array of MemberType | |
data[].key required | string | A lowercase letter, then up to 31 lowercase letters, digits or _: what x-hixel-member-type sends. |
data[].name required | string | A display name, 1 to 64 characters. |
data[].budget_micros required | TypeBudgetMicros | null | The most each member of the type may spend per calendar month (UTC), whatever its customer sets; null for no cap from the type. |
data[].allowed_models required | array of string | null | Model names and prefix/* patterns members of the type may use, within the environment's; null restricts nothing. |
data[].updated_at required | string | null | When it last changed; null for the type member while it has no settings. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.environment_required: a project key was sent withoutx-hixel-environment.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/member_types" \
-H "Authorization: Bearer $HIXEL_API_KEY"const memberTypeList = await hixel.memberTypes.list();Create or replace a member type#
Creates the type key (201) or replaces its settings (200), and publishes it to the gateway. An environment has at most 20 types (member_types_limit_reached). Takes a project key with the admin role and x-hixel-environment, as changing the gateway settings does.
Takes a project key with the admin role, naming the environment in x-hixel-environment; an environment's own key may not. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
key required | path | string | The member type's key. |
Request body: PutMemberTypeBody
| Field | Type | Description |
|---|---|---|
name required | string | A display name, 1 to 64 characters. |
budget_micros | TypeBudgetMicros | null | The cap per member each calendar month (UTC); null or left out for none. |
allowed_models | array of string | null | Up to 256 model names and prefix/* patterns; null or left out restricts nothing. |
Response 200, 201: MemberType
200: The type existed and was replaced. 201: The type was created.
| Field | Type | Description |
|---|---|---|
key required | string | A lowercase letter, then up to 31 lowercase letters, digits or _: what x-hixel-member-type sends. |
name required | string | A display name, 1 to 64 characters. |
budget_micros required | TypeBudgetMicros | null | The most each member of the type may spend per calendar month (UTC), whatever its customer sets; null for no cap from the type. |
allowed_models required | array of string | null | Model names and prefix/* patterns members of the type may use, within the environment's; null restricts nothing. |
updated_at required | string | null | When it last changed; null for the type member while it has no settings. |
Errors
- 400
invalid_parameter: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: the project key was sent withoutx-hixel-environment.invalid_params,invalid_payload,malformed_body,body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the project key was revoked or expired while the request ran.project_key_required: an environment's key was sent; this endpoint takes a project key.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, or an archived one. - 409
project_archived: This project is archived.environment_archived: This environment is archived.member_types_limit_reached: The environment has the most member types it may (20). Remove one first.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X PUT "https://api.hixel.dev/v1/member_types/key_123" \
-H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
-H "x-hixel-environment: env_123" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Inc."
}'const memberType = await hixel.environment("env_123").memberTypes.put("key_123", {
name: "Acme Inc.",
});Remove a member type#
Removes the type key, refused while a member row or a customer's default budget names it (member_type_in_use). Removing member returns it to no cap and no models. Answers 204 with no body. Takes a project key with the admin role.
Takes a project key with the admin role, naming the environment in x-hixel-environment; an environment's own key may not. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
key required | path | string | The member type's key. |
Response 204
No body.
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: the project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the project key was revoked or expired while the request ran.project_key_required: an environment's key was sent; this endpoint takes a project key.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
member_type_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, or an archived one.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.member_type_in_use: A member or a customer's default budget still names this member type. Change them first.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X DELETE "https://api.hixel.dev/v1/member_types/key_123" \
-H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
-H "x-hixel-environment: env_123"await hixel.environment("env_123").memberTypes.remove("key_123");