API Keys

Manage API keys for client access and authentication

<%= link_to new_admin_api_key_path, class: "mt-4 sm:mt-0 inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 transition-all" do %> Create New API Key <% end %>
<% if @api_keys.any? %>
<% @api_keys.each do |api_key| %> <% end %>
Name Key Prefix Permissions Status Last Used Created Actions
<%= api_key.name %>
<%= api_key.key_prefix %>...
<% perms = api_key.permissions || {} %> <% perms = {} unless perms.is_a?(Hash) %> <% if perms.any? %> <% perms.select { |_, v| v }.keys.each do |perm| %> <%= perm.to_s.humanize %> <% end %> <% else %> None <% end %>
<% if api_key.active_and_valid? %> Active <% elsif !api_key.active %> Revoked <% else %> Expired <% end %> <% if api_key.last_used_at %> <%= time_ago_in_words(api_key.last_used_at) %> ago <% else %> Never <% end %> <%= api_key.created_at.strftime("%Y-%m-%d") %> <% if api_key.active %> <%= button_to admin_api_key_path(api_key), method: :delete, class: "inline-flex items-center gap-1 text-red-600 hover:text-red-900", data: { confirm: "Are you sure you want to revoke this API key?" } do %> Revoke <% end %> <% end %>
<% else %>

No API keys

Get started by creating a new API key.

<%= link_to new_admin_api_key_path, class: "inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500" do %> Create API Key <% end %>
<% end %>