---
title: "Create API Key"
full: true
_openapi:
  method: POST
  toc: []
  structuredData:
    headings: []
    contents:
      - content: "Creates a new API key"
_apiData:
  document: "https://reloop.sh/api/api-key/openapi/json"
  operationData: [{"path":"/api/api-key/v1/","method":"post"}]
  parameterList: [{"name":"name","type":"string","required":true,"description":"Name for the API key","location":"body","minLength":1,"maxLength":255}]
  responseMap: {"201":{"description":"Response for status 201","schema":{"id":"key_123456789","name":"Production API Key","key":"rl_live_abc123def456ghi789","enabled":true,"createdAt":"2026-03-29T10:00:00Z","updatedAt":"2026-03-29T10:00:00Z","permissions":"read,write"}},"403":{"description":"Response for status 403","schema":{"message":"Unauthorized access"}}}
  codeSamples:
    - id: node
      lang: javascript
      label: Node.js
      source: |-
        import { Reloop } from "reloop-email";
        
        const reloop = new Reloop({ apiKey: "rl_123456789" });
        
        const { apiKey, apiKeyError } = await reloop.apiKey.create({
          name: "Production Key",
        });
        
        if (apiKeyError) throw apiKeyError;
        
        console.log(apiKey.id, apiKey.key);
    - id: curl
      lang: bash
      label: cURL
      source: |-
        curl -X POST https://reloop.sh/api/api-key/v1/ \
          -H "x-api-key: rl_123456789" \
          -H "Content-Type: application/json" \
          -d '{"name": "Production Key"}'
    - id: python
      lang: python
      label: Python
      source: |-
        from reloop_email import Reloop
        
        reloop = Reloop(api_key="rl_123456789")
        
        result = reloop.api_key.create({
          "name": "Production Key",
        })
        
        if result.api_key_error:
            raise result.api_key_error
        
        print(result.api_key["id"], result.api_key["key"])
    - id: php
      lang: php
      label: PHP
      source: |-
        <?php
        
        require 'vendor/autoload.php';
        
        use Reloop\Reloop;
        
        $reloop = Reloop::client('rl_123456789');
        
        $apiKey = $reloop->apiKey->create([
            'name' => 'Production Key',
        ]);
        echo $apiKey['id'] . ' ' . $apiKey['key'] . PHP_EOL;
    - id: java
      lang: java
      label: Java
      source: |-
        import sh.reloop.ReloopClient;
        ReloopClient reloop = new ReloopClient("rl_123456789");
        
        CreateApiKeyParams params = new CreateApiKeyParams();
        params.name = "Production Key";
        var apiKey = reloop.apiKey.create(params);
        System.out.println(apiKey.id + " " + apiKey.key);
    - id: dotnet
      lang: csharp
      label: .NET
      source: |-
        using Reloop;
        using Reloop.Models;
        
        var reloop = new ReloopClient("rl_123456789");
        
        var apiKey = await reloop.ApiKeys.CreateAsync(new CreateApiKeyParams(Name: "Production Key"));
    - id: go
      lang: go
      label: Go
      source: |-
        import reloop "github.com/reloop-labs/reloop-go"
        
        client, _ := reloop.NewClient(reloop.ClientOptions{
            APIKey: "rl_123456789",
        })
        
        apiKey, _ := client.ApiKeys.Create(reloop.CreateApiKeyParams{
            Name: "Production Key",
        })
    - id: rust
      lang: rust
      label: Rust
      source: |-
        use reloop::ReloopClient;
        #[tokio::main]
        async fn main() -> Result<(), Box<dyn std::error::Error>> {
            let reloop = ReloopClient::new("rl_123456789".to_string(), None);
        
            reloop.api_keys().create(CreateApiKeyParams {
                name: "Production Key".to_string(),
            }).await?;
        
            Ok(())
        }
    - id: ruby
      lang: ruby
      label: Ruby
      source: |-
        require "reloop"
        
        reloop = Reloop::Client.new(api_key: "rl_123456789")
        
        api_key = reloop.api_keys.create(name: "Production Key")
    - id: elixir
      lang: elixir
      label: Elixir
      source: |-
        client = Reloop.client("rl_123456789")
        
        {:ok, api_key} = Reloop.Services.ApiKey.create(client, %{name: "Production Key"})
---
> For the complete documentation index, see [llms-docs.txt](/llms-docs.txt) or the site index [llms.txt](/llms.txt). Full docs corpus: [llms-full-docs.txt](/llms-full-docs.txt). Prefer markdown URLs (append `.md`) for agent consumption. Product skill: [skill.md](/skill.md).


{/* This file was generated by the OpenAPI doc generator. Do not edit this file directly. Run `bun run generate:api-docs` to regenerate. */}

<APIPage />
