API 키 발급
POST/v1/organizations/{org_id}/workspaces/{workspace_id}/api-keys
워크스페이스에 묶인 API 키를 발급합니다, 비밀 값은 이 응답에서 한 번만 보입니다
콘솔 세션 전용입니다, 조직 역할 owner, admin, developer만 부를 수 있고 API 키로 부르면 403 console_only입니다
- 개발자는 자기에게 배정된 워크스페이스에서만 키를 만들 수 있습니다
secret은 이 응답에서만 보입니다, 서버는 해시만 저장합니다
Headers
- Cookie: string콘솔 로그인 세션 쿠키, 콘솔 전용 엔드포인트라 API 키로 부르면 403 console_only입니다
- Origin: string콘솔 세션으로 상태를 바꿀 때 같은 출처(https://xenoci.com)여야 합니다, API 키 요청에는 필요 없습니다
Path Parameters
- org_id: string조직 ID형식
^org_[A-Za-z0-9]+$ - workspace_id: string워크스페이스 ID형식
^wrk_[A-Za-z0-9]+$
Body
- name: string키 이름80자 이하
- permission: optional "run" or "read"run(잡 제출과 취소, 조회) 또는 read(조회만), 기본 run
- expires_in_days: optional 30 or 90 or 365 or null30, 90, 365 또는 null(만료 없음)기본값
null - expires_at: optional string or null정확한 만료 시각, 1시간 뒤부터 1년 뒤까지, expires_in_days와 함께 쓸 수 없습니다RFC 3339 UTC 시각
Returns
201 application/json
ApiKeyCreated: object
- id: stringID형식
^key_[A-Za-z0-9]+$ - organization_id: optional string조직 ID
- workspace_id: string워크스페이스 ID
- name: string이름
- permission: "run" or "read"권한(run 또는 read)
- prefix_display: string앞 12자와 뒤 4자, 예 xci_live_3fK…Pm81
- status: "active" or "disabled" or "revoked" or "expired"active, revoked, expired
- created_by: optional string or null만든 사용자
- created_at: string만든 시각RFC 3339 UTC 시각
- last_used_at: optional string or null마지막 사용 시각
- expires_at: optional string or null만료 시각, 없으면 null
- revoked_at: optional string or null폐기 시각
- revoke_reason: optional "user" or "leaked_public" or "workspace_archived" or nulluser(사용자 폐기), leaked_public(공개 유출 자동 폐기), workspace_archived(워크스페이스 보관), 아니면 null
- disabled_at: optional string or null키를 끈 시각, 꺼진 키는 다시 켤 때까지 폐기된 키처럼 거부됩니다RFC 3339 UTC 시각
- allowed_cidrs: optional array of string키별 CIDR 허용 목록, 조직 목록에 더해 검사합니다, 비어 있으면 추가 제한 없음
- secret: string키 비밀 값, 이 응답에서만 보이고 기록에 남지 않습니다형식
^xci_live_[A-Za-z0-9]{43}_[A-Za-z0-9]{6}$
오류
- invalid_request: HTTP 400본문이나 쿼리가 검증에 실패했습니다, error.details.fields에 문제 필드가 있습니다
- session_required: HTTP 401콘솔 엔드포인트를 유효한 콘솔 세션 쿠키 없이 불렀습니다
- console_only: HTTP 403콘솔 세션 전용 엔드포인트입니다, API 키로는 결제, 키, 멤버 관리를 할 수 없습니다
- insufficient_permission: HTTP 403역할이나 키 권한(run/read)이 이 요청을 허용하지 않습니다
- workspace_archived: HTTP 403보관된 워크스페이스입니다, 키는 폐기되었고 새 잡은 거절됩니다
- not_found: HTTP 404자원이 없거나 이 호출자에게 보이지 않습니다
- rate_limited: HTTP 429, 다시 시도 가능이 키 또는 조직의 요청이 너무 많습니다, retry_after_s만큼 기다리세요
- internal_error: HTTP 500, 다시 시도 가능예상하지 못한 오류입니다, 다시 시도하고 반복되면 request_id와 함께 알려 주세요
오류 봉투 모양과 전체 코드 표는 오류 코드에 있습니다
다음 단계
- API 키 목록 GET /v1/organizations/{org_id}/api-keys
- API 키 이름 바꾸기 PATCH /v1/organizations/{org_id}/api-keys/{key_id}
- API 키 폐기 POST /v1/organizations/{org_id}/api-keys/{key_id}/revoke