API 레퍼런스
API 키 업데이트
기존 Standard API 키를 업데이트하고 현재 사용량 요약을 조회합니다.
기존 Standard API 키를 업데이트하고 현재 사용량 요약을 조회합니다.
엔드포인트
- Base URL
https://runapi.ai- API 버전
v1- 인증
Authorization: Bearer YOUR_MANAGEMENT_API_KEY
02
JSON 본문요청
나열된 요청 위치에만 값을 전송하세요.
JSON 본문필드 6개
allowed_modelsarray | null
선택
대체 모델 허용 목록. null 또는 빈 배열은 목록을 지웁니다.
credit_limit_centsinteger | null
선택
지출 한도(USD 센트); null로 설정하면 한도와 재설정 주기가 해제됩니다.
credit_limit_reset_intervalstring | null
선택
지출 한도 초기화 주기.
허용 값:daily, weekly, monthly
credit_limit_windowsobject
선택
1h, 1d, 또는 7d를 키로 하는 교체용 롤링 지출 한도; 빈 객체를 전달하면 모든 롤링 한도가 초기화됩니다.
enabledboolean
선택
이 키를 사용한 요청이 허용되는지 여부.
namestring
선택
API 키의 대체 친숙한 이름.
경로 매개변수필드 1개
idstring
필수
API 키 접두사 ID(예: token_123).
03
HTTP 200성공 응답
PATCH /api/v1/keys/:id
JSON
{
"allowed_models": [
"gpt-5.4"
],
"created_at": "2026-07-27T10:00:00.000Z",
"credit_limit_cents": 1000,
"credit_limit_reset_interval": "daily",
"credit_limit_windows": {},
"credit_usage_cents_by_model": {
"gpt-5.4": 250
},
"credit_usage_cents_this_month": 250,
"credit_usage_cents_this_week": 100,
"credit_usage_cents_today": 25,
"credit_usage_cents_total": 250,
"enabled": true,
"guardrail_id": "guardrail_123",
"id": "token_123",
"last_used_at": null,
"masked_token": "runapi_abc...wxyz",
"name": "Production primary"
}
04
HTTP 401오류 응답 (401)
응답 스키마
JSON
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
JSON
{
"error": "Authentication required"
}
05
HTTP 403오류 응답 (403)
응답 스키마
JSON
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
JSON
{
"error": "Management API key required"
}
06
HTTP 403오류 응답 (403)
응답 스키마
JSON
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
JSON
{
"error": "Account admin required"
}
07
HTTP 400오류 응답 (400)
응답 스키마
JSON
{
"oneOf": [
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 유효성 검사 요약입니다.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "공개 요청 필드를 키로 하는 유효성 검사 메시지로, 각 필드에 대해 사람이 읽을 수 있는 문자열 배열이 포함됩니다.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
응답 예시
JSON
{
"error": "page must be an integer"
}
08
HTTP 404오류 응답 (404)
응답 스키마
JSON
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
JSON
{
"error": "Resource not found"
}
09
HTTP 422오류 응답 (422)
응답 스키마
JSON
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 유효성 검사 요약입니다.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "공개 요청 필드를 키로 하는 유효성 검사 메시지로, 각 필드에 대해 사람이 읽을 수 있는 문자열 배열이 포함됩니다.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
JSON
{
"error": "Validation failed",
"errors": {
"base": [
"Validation failed"
]
}
}
10
cURL 예시
CURL
curl -X PATCH https://runapi.ai/api/v1/keys/token_123 \
-H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"Production primary","enabled":true,"credit_limit_windows":{}}'