<% if @newly_created && @plain_key %>

API Key Created Successfully

<%= render DS::FilledIcon.new( icon: "check-circle", rounded: true, size: "lg", variant: :success ) %>

API Key Created Successfully!

Your new API key "<%= @current_api_key.name %>" has been created and is ready to use.

Your API Key

Copy and store this key securely. You'll need it to authenticate your API requests.

<%= @current_api_key.plain_key %> <%= render DS::Button.new( text: "Copy API Key", variant: "ghost", icon: "copy", data: { action: "clipboard#copy" } ) %>

How to use your API key

Include your API key in the X-Api-Key header when making requests:

curl -H "X-Api-Key: <%= @current_api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<%= render DS::Link.new( text: "Continue to API Key Settings", href: settings_api_key_path, variant: "primary" ) %>
<% elsif @current_api_key %>

Your API Key

<%= render DS::Link.new( text: "Create New Key", href: new_settings_api_key_path(regenerate: true), variant: "secondary" ) %>
<%= render DS::FilledIcon.new( icon: "key", rounded: true, size: "lg" ) %>

<%= @current_api_key.name %>

Created <%= time_ago_in_words(@current_api_key.created_at) %> ago <% if @current_api_key.last_used_at %> • Last used <%= time_ago_in_words(@current_api_key.last_used_at) %> ago <% else %> • Never used <% end %>

Active

Permissions

<% @current_api_key.scopes.each do |scope| %> <%= icon("shield-check", class: "w-3 h-3") %> <%= case scope when "read" then "Read Only" when "read_write" then "Read/Write" else scope.humanize end %> <% end %>

Your API Key

Copy and store this key securely. You'll need it to authenticate your API requests.

<%= @current_api_key.plain_key %> <%= render DS::Button.new( text: "Copy API Key", variant: "ghost", icon: "copy", data: { action: "clipboard#copy" } ) %>

How to use your API key

Include your API key in the X-Api-Key header when making requests:

curl -H "X-Api-Key: <%= @current_api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<%= render DS::Button.new( text: "Revoke Key", href: settings_api_key_path, method: :delete, variant: "destructive", data: { turbo_confirm: "Are you sure you want to revoke this API key?" } ) %>
<% else %>

<%= t(".no_api_key.title") %>

<%= render DS::Link.new( text: t(".no_api_key.create_api_key"), href: new_settings_api_key_path, variant: "primary" ) %>
<%= render DS::FilledIcon.new( icon: "key", rounded: true, size: "lg" ) %>

<%= t(".no_api_key.heading", product_name: product_name) %>

<%= t(".no_api_key.description") %>

<%= t(".no_api_key.what_you_can_do") %>

  • <%= icon("check", class: "w-4 h-4 text-primary mt-0.5") %> <%= t(".no_api_key.feature_1") %>
  • <%= icon("check", class: "w-4 h-4 text-primary mt-0.5") %> <%= t(".no_api_key.feature_2") %>
  • <%= icon("check", class: "w-4 h-4 text-primary mt-0.5") %> <%= t(".no_api_key.feature_3") %>

<%= t(".no_api_key.security_note_title") %>

<%= t(".no_api_key.security_note") %>

<% end %>