<%= content_for :page_title, "API Key Created" %> <%= settings_section title: "API Key Created Successfully", subtitle: "Your new API key has been generated successfully." do %>
<%= render DS::FilledIcon.new( icon: "check-circle", rounded: true, size: "lg", variant: :success ) %>

API Key Created Successfully!

Your new API key "<%= @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.

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

Key Details

Name: <%= @api_key.name %>
Permissions: <%= @api_key.scopes.map { |scope| case scope when "read_accounts" then "View Accounts" when "read_transactions" then "View Transactions" when "read_balances" then "View Balances" when "write_transactions" then "Create Transactions" else scope.humanize end }.join(", ") %>
Created: <%= @api_key.created_at.strftime("%B %d, %Y at %I:%M %p") %>
<%= icon("alert-triangle", class: "w-5 h-5 text-warning-600 mt-0.5") %>

Important Security Note

This is the only time your API key will be displayed. Make sure to copy it now and store it securely. If you lose this key, you'll need to generate a new one.

How to use your API key

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

curl -H "X-Api-Key: <%= @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" ) %>
<% end %>