Niftory Docs
  • What is Niftory?
  • Get your API Keys
  • 👩‍💻API
    • Niftory Web3 API
    • SDK QuickStart
      • Using the SDK in React
      • Using the SDK from the Server
    • API Quickstart
      • Create your first Wallet
      • API calls with Sample Content
      • Mint your first NFT
    • API Cheat Sheet
    • Niftory Sample App
      • Explore the Sample App
      • Anatomy of a Niftory App
        • Getting Authenticated
        • GraphQL Client Setup
        • API Usage
        • Transfer an NFT
    • 💡Core Concepts
      • Niftory Data Model
      • Authentication
        • Using Your API Key
        • Configuring Your App
        • Privileged Authentication
      • App and AppUser
      • NFTs
        • Creating NFTs
        • Querying NFTs
        • Transferring NFTs
        • Minting NFTs
      • Wallets
        • Create a Niftory Wallet
        • Register External Wallets
        • Query Wallets
      • Contract
      • User Auth (Client-Side)
    • Your Niftory Account
  • 🧑‍💼Admin Portal
    • Niftory Admin Portal
    • 🚀Guides
      • Setting Up Your Org
      • Create Your First NFT
    • 🗺️Explore
      • Org and Apps
      • NFT Collection
        • Sets
        • Collectibles
        • NFTs
    • 💼Use Cases
      • For Engineers
      • For Designers
      • For Business Users
  • 📖Reference
    • GraphQL & Auth Endpoints
    • API Reference
    • SDK API Reference
Powered by GitBook
On this page
  • Get Your Keys
  • Using Your API Keys

Was this helpful?

  1. API
  2. Core Concepts
  3. Authentication

Using Your API Key

PreviousAuthenticationNextConfiguring Your App

Last updated 1 year ago

Was this helpful?

Your API key is required for every request made to access content for your App. It should be passed as the "X-Niftory-API-Key" header. In addition, you'll receive a secret key, which provides full access to privileged actions on your behalf (minting, setting up wallets, querying users, etc). This should be passed in as "X-Niftory-Client-Secret"

This key identifies your application. It can be used on its own for any operation you'd want anyone visiting your application to be able to perform without logging in, like querying NFTs.

The API Key alone cannot be used to query any user or sensitive app data or perform any mutations. For that, see .

Get Your Keys

Go to the and follow these steps:

  1. You should automatically be redirected to the Your App page. If not, click on your User Profile, and select App.

  2. Click to get all of your secrets and start building. You're all set to go!

Niftory API Keys

Using Your API Keys

In our SDK samples, you'll usually see us creating a separate client for simple use-cases vs the privileged use-cases.

Standard Niftory SDK Client (API Key Only)
import { EnvironmentName, NiftoryClient, NiftoryProvider } from "@niftory/sdk"
import { useMemo } from "react"
import { useWalletContext } from "../hooks/useWalletContext"

export const NiftoryClientProvider = ({ children }) => {
  const client = useMemo(() => {
    return new NiftoryClient({
      environmentName: process.env.NEXT_PUBLIC_BLOCKCHAIN_ENV as EnvironmentName,
      appId: process.env.NEXT_PUBLIC_CLIENT_ID,
      apiKey: process.env.NEXT_PUBLIC_API_KEY,
    })
  }, [])

  return <NiftoryProvider client={client}>{children}</NiftoryProvider>
}
Privileged Niftory SDK Client (API Key + Client Secret)
import { EnvironmentName, NiftoryClient } from "@niftory/sdk"
let client: NiftoryClient

/**
 * Gets a NIFTORY client for use in the backend.
 * @returns A NiftorySdk client.
 */
export function getBackendNiftoryClient() {
  client =
    client ||
    new NiftoryClient({
      environmentName: process.env.NEXT_PUBLIC_BLOCKCHAIN_ENV as EnvironmentName,
      appId: process.env.NEXT_PUBLIC_CLIENT_ID,
      apiKey: process.env.NEXT_PUBLIC_API_KEY,
      clientSecret: process.env.CLIENT_SECRET,
    })

  return client
}

For simple commands (generally getting data like your NFTs, Wallets, etc), you can just use your API Key, which is safe to call for any application. For privileged commands, you'll use the Client Secret or our OAuth integrations. Read more in the section.

👩‍💻
💡
Privileged Authentication
Types of Authentication
Niftory Admin Portal
Setup and Get Keys