조직 초대 API (Organization invitations)
조직 초대 REST API는 권한 있는 사용자가 Buildkite 조직의 초대를 나열·조회·생성·폐기할 수 있게 해줘요.
출처: 문서
본문
조직 초대 데이터 모델
id |
초대의 UUID |
|---|---|
graphql_id |
초대의 GraphQL ID. GraphQL API로 초대를 조회하는 데 사용해요. |
url |
이 초대의 정식 API URL |
email |
초대가 전송된 이메일 주소 |
state |
초대의 현재 상태: pending, accepted, revoked, 또는 expired |
role |
제공된 조직 역할: admin 또는 member |
sso_mode |
초대된 멤버의 SSO 요구 사항: required 또는 optional |
teams |
초대에 포함된 팀 배열. 각 항목에는 팀 id(UUID), graphql_id, slug가 포함돼요. |
created_at |
초대가 생성된 시점의 ISO 8601 타임스탬프 |
created_by |
초대를 생성한 사용자 |
accepted_at |
초대가 수락된 시점의 ISO 8601 타임스탬프, 또는 null |
accepted_by |
초대를 수락한 사용자, 또는 null |
revoked_at |
초대가 폐기된 시점의 ISO 8601 타임스탬프, 또는 null |
revoked_by |
초대를 폐기한 사용자, 또는 null |
expired_at |
초대가 만료된 시점의 ISO 8601 타임스탬프, 또는 null |
조직 초대 목록 조회
조직의 보류 중인 초대 페이지네이션된 목록을 최신순에서 가장 오래된 순으로 반환해요. 목록에는 수락·폐기·만료된 초대가 포함되지 않아요. 그런 초대는 UUID로 개별 조회할 수 있어요.
curl -H "Authorization: Bearer ***" \
-X GET "https://api.buildkite.com/v2/organizations/{org.slug}/invitations"
{
"items": [
{
"id": "00000000-0000-4000-8000-000000000001",
"graphql_id": "T3JnYW5pemF0aW9uSW52aXRhdGlvbi0tLTAwMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDAwMQ==",
"url": "https://api.buildkite.com/v2/organizations/acme-inc/invitations/00000000-0000-4000-8000-000000000001",
"email": "new-member@example.com",
"state": "pending",
"role": "member",
"sso_mode": "required",
"teams": [],
"created_at": "2024-11-12T09:15:04.000Z",
"created_by": {
"id": "00000000-0000-4000-8000-000000000002",
"name": "Example User",
"email": "example@example.com"
},
"accepted_at": null,
"accepted_by": null,
"revoked_at": null,
"revoked_by": null,
"expired_at": null
}
],
"links": {
"self": "https://api.buildkite.com/v2/organizations/acme-inc/invitations?per_page=30",
"next": "https://api.buildkite.com/v2/organizations/acme-inc/invitations?per_page=30&after=eyJjcm...aIn0="
}
}
응답 본문에는 다음 페이지네이션 필드가 포함돼요.
items: 현재 페이지의 초대links: 현재 페이지 및 사용 가능한next페이지의 URL. 커서를 직접 만들지 말고 이 URL을 따라가요. 응답에는 이 링크들이 HTTPLink헤더에도 포함돼요.
선택 쿼리 문자열 매개변수:
after |
제공된 커서 뒤의 다음 페이지를 반환해요. before와 함께 사용할 수 없어요. |
|---|---|
before |
제공된 커서 앞의 이전 페이지를 반환해요. after와 함께 사용할 수 없어요. |
per_page |
페이지당 결과 수. 기본값은 30이고 최대값은 100이에요. |
필수 범위: read_organization_invitations
필수 권한: 조직 멤버를 초대할 권한
성공 응답: 200 OK
오류 응답:
400 Bad Request |
요청이 두 커서 매개변수를 모두 제공하거나, 문자열이 아닌 커서 값을 제공하거나, 지원 범위를 벗어난 per_page 값을 제공한 경우 |
|---|---|
403 Forbidden |
토큰에 필요한 범위가 없거나 사용자에게 조직 멤버를 초대할 권한이 없는 경우 |
조직 초대 조회
UUID로 단일 초대를 반환해요. 목록 엔드포인트와 달리, 이 엔드포인트는 모든 상태의 초대를 반환해요.
curl -H "Authorization: Bearer ***" \
-X GET "https://api.buildkite.com/v2/organizations/{org.slug}/invitations/{uuid}"
{
"id": "00000000-0000-4000-8000-000000000001",
"graphql_id": "T3JnYW5pemF0aW9uSW52aXRhdGlvbi0tLTAwMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDAwMQ==",
"url": "https://api.buildkite.com/v2/organizations/acme-inc/invitations/00000000-0000-4000-8000-000000000001",
"email": "new-member@example.com",
"state": "pending",
"role": "member",
"sso_mode": "required",
"teams": [],
"created_at": "2024-11-12T09:15:04.000Z",
"created_by": {
"id": "00000000-0000-4000-8000-000000000002",
"name": "Example User",
"email": "example@example.com"
},
"accepted_at": null,
"accepted_by": null,
"revoked_at": null,
"revoked_by": null,
"expired_at": null
}
필수 범위: read_organization_invitations
필수 권한: 조직 멤버를 초대할 권한
성공 응답: 200 OK
오류 응답:
403 Forbidden |
토큰에 필요한 범위가 없거나 사용자에게 조직 멤버를 초대할 권한이 없는 경우 |
|---|---|
404 Not Found |
초대 UUID가 존재하지 않거나 다른 조직에 속한 경우 |
조직 초대 생성
하나 이상의 이메일 주소에 대한 초대를 생성해요. 응답에는 생성된 초대가 포함돼요. API는 대소문자와 무관하게 중복 이메일 주소를 하나의 주소로 취급해요. 전체 배치가 모든 초대가 생성되기 전에 검증돼요. 주소가 하나라도 유효하지 않으면 어떤 초대도 생성되지 않아요.
curl -H "Authorization: Bearer ***" \
-X POST "https://api.buildkite.com/v2/organizations/{org.slug}/invitations" \
-H "Content-Type: application/json" \
-d '{
"emails": ["member@example.com", "admin@example.com"],
"role": "member",
"sso_mode": "required",
"teams": [
{ "id": "00000000-0000-4000-8000-000000000003", "role": "member" }
]
}'
[
{
"id": "00000000-0000-4000-8000-000000000001",
"graphql_id": "T3JnYW5pemF0aW9uSW52aXRhdGlvbi0tLTAwMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDAwMQ==",
"url": "https://api.buildkite.com/v2/organizations/acme-inc/invitations/00000000-0000-4000-8000-000000000001",
"email": "member@example.com",
"state": "pending",
"role": "member",
"sso_mode": "required",
"teams": [
{ "id": "00000000-0000-4000-8000-000000000003", "graphql_id": "TEAM_GRAPHQL_ID", "slug": "example-team" }
],
"created_at": "2024-11-12T09:15:04.000Z",
"created_by": {
"id": "00000000-0000-4000-8000-000000000002",
"name": "Example User",
"email": "example@example.com"
},
"accepted_at": null,
"accepted_by": null,
"revoked_at": null,
"revoked_by": null,
"expired_at": null
}
]
필수 요청 본문 속성:
emails |
초대할 이메일 주소 문자열 배열 |
|---|
선택 요청 본문 속성:
role |
초대 대상자에게 부여할 조직 역할: admin 또는 member. 기본값은 member예요. |
|---|---|
sso_mode |
초대 대상자의 SSO 요구 사항: required 또는 optional. 조직에서 SSO가 비활성화된 경우 이 필드를 생략하면 기본값은 required예요. SSO가 활성화된 경우 이 필드는 필수이며, 생략하면 422 Unprocessable Entity를 반환해요. |
teams |
팀 지정 객체 배열. 각 객체에는 id(팀 UUID)와 role(member 또는 maintainer)이 필요해요. 팀당 최대 하나의 지정을 제공해요. 팀 지정을 건너뛰려면 생략하거나 빈 배열을 제공해요. |
필수 범위: write_organization_invitations
필수 권한: 조직 멤버를 초대할 권한
성공 응답: 201 Created
오류 응답:
403 Forbidden |
토큰에 필요한 범위가 없거나 사용자에게 조직 멤버를 초대할 권한이 없는 경우 |
|---|---|
422 Unprocessable Entity |
요청에 잘못된 입력이 있는 경우. 예: 잘못된 형식의 이메일 주소, 잘못된 역할 또는 SSO 모드, 충돌하는 팀 지정, 이미 멤버인 이메일 주소, 조직의 초대 할당량을 초과하는 배치 크기, 조직 사용자 한도에 도달한 경우 등. 조직에서 SSO가 활성화되어 있고 요청이 sso_mode를 생략한 경우에도 이 응답이 발생해요. |
조직 초대 폐기
보류 중인 초대를 폐기해요. 성공하면 내용 없는 응답을 반환해요. 보류 중인 초대만 폐기할 수 있어요.
curl -H "Authorization: Bearer ***" \
-X DELETE "https://api.buildkite.com/v2/organizations/{org.slug}/invitations/{uuid}"
필수 범위: write_organization_invitations
필수 권한: 조직 멤버를 초대할 권한
성공 응답: 204 No Content
오류 응답:
403 Forbidden |
토큰에 필요한 범위가 없거나 사용자에게 조직 멤버를 초대할 권한이 없는 경우 |
|---|---|
404 Not Found |
초대 UUID가 존재하지 않거나 다른 조직에 속한 경우 |
422 Unprocessable Entity |
초대가 이미 수락·폐기·만료되어 폐기할 수 없는 경우 |