api-keys

Resend API 키

Resend API 키는 이메일 전송을 비롯한 Resend의 API 요청을 인증하는 데 사용해요. 각 API 키는 re_로 시작하는 고유한 토큰 값으로 발급되고, 권한을 full_accesssending_access로 제한할 수 있어요. API 키를 만들고, 조회하고, 이름을 바꾸고, 삭제하는 모든 작업은 API 레퍼런스의 api-keys 엔드포인트로 처리할 수 있어요.

출처: 문서

본문

API 키 생성 (Create API key)

새 API 키를 만들어 Resend와의 통신을 인증해요.

Body 파라미터

  • name (string, 필수): API 키 이름. 최대 50자.
  • permission (full_access | sending_access): API 키가 Resend API에 대한 전체 접근 권한을 가질지, 이메일 전송만 가능할지 정해요.
    • full_access: 어떤 리소스든 생성·삭제·조회·수정할 수 있어요.
    • sending_access: 이메일 전송만 할 수 있어요.
  • domain_id (string): 특정 도메인에서만 이메일을 보내도록 API 키를 제한해요. permissionsending_access일 때만 사용돼요.

예시 (cURL)

curl -X POST 'https://api.resend.com/api-keys' \
     -H 'Authorization: Bearer ***' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "Production"
}'

예시 (CLI)

resend api-keys create --name Production

예시 (Node.js)

import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.apiKeys.create({ name: 'Production' });

응답 예시

{
  "id": "dacf4072-4119-4d88-932f-6202748ac7c8",
  "object": "api_key",
  "token": "re_c1tpEyD8_NKFusih9vKVQknRAQfmFcWCv"
}

API 키 조회 (List API keys)

인증된 사용자의 API 키 목록을 가져와요.

쿼리 파라미터 (모두 선택)

  • limit (number): 가져올 API 키 수. 기본값 20, 최솟값 1, 최댓값 100. 지정하지 않으면 한 번에 모두 반환돼요.
  • after (string): 해당 ID 이후의 API 키를 가져와요 (페이지네이션). 반환 목록에 이 ID는 포함되지 않아요. before와 함께 쓸 수 없어요.
  • before (string): 해당 ID 이전의 API 키를 가져와요 (페이지네이션). 반환 목록에 이 ID는 포함되지 않아요. after와 함께 쓸 수 없어요.

afterbefore 중 하나만 사용해야 하고, 둘 다 쓸 수는 없어요.

예시 (cURL)

curl -X GET 'https://api.resend.com/api-keys' \
     -H 'Authorization: Bearer ***'

예시 (CLI)

resend api-keys list

예시 (Node.js)

import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.apiKeys.list();

응답 예시

{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "91f3200a-df72-4654-b0cd-f202395f5354",
      "name": "Production",
      "created_at": "2026-04-08 00:11:13.110779+00",
      "last_used_at": "2026-11-01 17:09:51.813959+00"
    }
  ]
}

API 키 이름 변경 (Update API key)

기존 API 키의 이름을 변경해요. 이 엔드포인트는 API 키의 이름만 수정하고, 권한이나 도메인을 바꾸려면 Resend Dashboard에서 수정해야 해요.

Path 파라미터

  • api_key_id (string, 필수): API 키 ID.

Body 파라미터

  • name (string, 필수): API 키 이름. 최대 50자.

예시 (cURL)

curl -X PATCH 'https://api.resend.com/api-keys/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \
     -H 'Authorization: Bearer ***' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "Production"
}'

예시 (CLI)

resend api-keys update b6d24b8e-af0b-4c3c-be0c-359bbd97381e --name Production

예시 (Node.js)

import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.apiKeys.update(
  'b6d24b8e-af0b-4c3c-be0c-359bbd97381e',
  { name: 'Production' },
);

응답 예시

{
  "object": "api_key",
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e"
}

API 키 삭제 (Delete API key)

기존 API 키를 제거해요. 삭제 후에는 해당 키로는 더 이상 API 요청을 인증할 수 없어요.

Path 파라미터

  • api_key_id (string, 필수): API 키 ID.

예시 (cURL)

curl -X DELETE 'https://api.resend.com/api-keys/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \
     -H 'Authorization: Bearer ***'

예시 (CLI)

resend api-keys delete b6d24b8e-af0b-4c3c-be0c-359bbd97381e

예시 (Node.js)

import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.apiKeys.remove(
  'b6d24b8e-af0b-4c3c-be0c-359bbd97381e',
);

응답 예시

{
  "object": "api_key",
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
  "deleted": true
}

더 알아보기 (Learn more)