---
title: "Create an API key so your own tools can read your ticket sales | Ticket Fairy-guider"
description: "Give the command line, a script or an agent its own key to your ticket sales, choose how long it lasts, and take it back the moment you need to."
canonical: "https://www.ticketfairy.com/sv/guides/create-an-api-key-for-your-own-app"
---

1. [Ticket Fairy](https://www.ticketfairy.com/)
2. [Guider](https://www.ticketfairy.com/sv/guides)
3. Create an API key so your own tools can read your ticket sales

Utvecklare och API:et

# Create an API key so your own tools can read your ticket sales

With an API key, your own spreadsheet, dashboard or agent can read what you can read, and nobody has to share a dashboard password. If you run more than a handful of events, you can keep your ticket sales in the tools you already work in.

Tar:  7 minuter

- [Open your account settings](#step-1)
- [Name the token after the tool that will hold it](#step-2)
- [Choose how long it should last](#step-3)
- [Copy the token before you close the window](#step-4)
- [Generate the brand key for the event APIs](#step-5)

## Innan du börjar

- You know which tool needs the access: a laptop, a server, a scheduled script or an agent. One token per tool lets you take access back from one of them without touching the others.
- You have somewhere safe to keep the token, such as your password manager or your build system's secret store. You see the token once, and never again.

1. ## Open your account settings

   Open your account settings and find **Personal Access Tokens**.

   **Obs:** Tokens belong to your own account rather than to a brand, because a token has your permissions. A teammate who needs their own access creates their own.

   ![The Personal Access Tokens card listing tokens with their created, last used and expiry dates](https://www.ticketfairy.com/embeds/posters/marketing-developer-access--personal-access-tokens.png)    
   *The tokens on an account, with one part-way through a rotation.*
2. ## Name the token after the tool that will hold it

   Select **New Personal Access Token** and enter the tool's name in **Token name**.

   **Obs:** Name it for the laptop, service or script rather than for the job, because the name is how you find the right row when you take access back.
3. ## Choose how long it should last

   Open **Set custom expiry** and pick a length that suits the tool.

   **Obs:** A year is the default and the longest available. Pick an hour or seven days for a one-off script, because a short life limits what a leak costs you.
4. ## Copy the token before you close the window

   Select **Create token** and copy the value it shows you into your password manager.

   **Obs:** You see the token only once. If you close the window without copying it, you'll need to revoke that token and create another.
5. ## Generate the brand key for the event APIs

   Find **API Key** on the same page and select **Generate API Key**.

   **Obs:** This is the key the event APIs ask for, the referral leaderboard among them. Regenerating it stops every application using the old key until you update them.

   ![The API Key and Webhook API Key cards, each showing the key with a control to copy it and one to regenerate it](https://www.ticketfairy.com/embeds/posters/marketing-developer-access--api-keys.png)    
   *The two keys, once each has been generated.*

## Eller låt det göras åt dig

Fai, din AI-lagkamrat, kan kolla försäljningen, uppdatera ditt evenemang eller ändra en biljett när du ber om det.

Fai can open the page where you manage tokens. You create one yourself, because only you see the token, and only once.

### I din instrumentpanel, med Fai

```
Open my account settings so I can create an access token
```

## Från din terminal

Installera CLI:t från [vår CLI-sida](https://www.ticketfairy.com/cli), logga in med `ticketfairy auth login` och välj varumärket du arbetar med via `ticketfairy brand use <BRAND_ID>`. `ticketfairy brand list` och `ticketfairy event list` visar de ID:n som de andra kommandona använder.

Create a token from the command line, or use one you created in the dashboard by setting it as TICKET\_FAIRY\_API\_KEY, then check which brands it can act for.

### Create a token; the CLI prints it once

```
ticketfairy auth tokens create "<TOKEN NAME>"
```

### Show the brands the token can act for

```
ticketfairy brand list
```

## Swap a token without any downtime

1. ### Rotate it instead of replacing it

   Select **Rotate** on the row and copy the new token.

   **Obs:** Rotating creates a fresh token under the same name and leaves the old one working for a grace period. Update every script and service before that window ends.
2. ### Tell the two rows apart afterwards

   Look for the badge marking the older half of the rotation before you remove anything.

   **Obs:** Both rows have the same name, so the badge is what stops you taking the fresh token out of service by mistake.

Fai can open the page. You rotate the token and copy the new one yourself, because only you see the new value, and only once.

### I din instrumentpanel, med Fai

```
Open my account settings so I can rotate an access token
```

### Från din terminal

Rotate a token from the command line, then use the new value.

#### Rotate a token; the CLI prints the new value once

```
ticketfairy auth tokens rotate <TOKEN_ID>
```

## Take access back

1. ### Revoke the token the moment it leaks

   Select **Revoke** on the row for the tool that is affected.

   **Obs:** Revoking stops that token immediately and cannot be undone. The tool needs a new token before it works again.

Fai can open the page. Revoking a token is something you do yourself, because it stops a live integration the moment it happens.

### I din instrumentpanel, med Fai

```
Open my account settings so I can revoke an access token
```

### Från din terminal

List your tokens and revoke one from the command line.

#### List your tokens and their ids

```
ticketfairy auth tokens list
```

#### Revoke a token

```
ticketfairy auth tokens revoke <TOKEN_ID>
```

## Frågor du kanske har

**Which one do I use for the command line?**

 A personal access token. The command line, your own scripts and your agents all sign in with one, and each inherits the permissions your dashboard account has.

**What is the API key for, then?**

 The event APIs, such as your referral leaderboard. It belongs to the account that generates it, so a tool meant to outlive one person needs a key from an account that stays on the team.

**Can a token do everything I can?**

 Within your permissions, yes. That is why one token per tool and a short expiry are worth the extra minute, and why revoking is instant and never rate limited.

**How many tokens can I create?**

 Ten an hour, counting rotations, and you cannot create a new one while fifty are already live. Waiting clears the hourly count; the fifty needs you to revoke one you have finished with. A rotation doesn't count towards the fifty, so you can have fifty-one until the old token's grace period ends.

**What if I close the window without copying the token?**

 Revoke that token and create another. The value is never shown again, so there is nothing to recover and nothing lost by starting over.

## Har du fortfarande en fråga?

Boka en demo så svarar vi på den i ett samtal, utifrån din typ av evenemang. Eller skapa ditt konto och se själv.

   [Boka en demo](https://www.ticketfairy.com/sv/event-ticketing/book-a-demo) [Skapa ett gratiskonto](https://manage.ticketfairy.com/welcome)

Inga startavgifter. Ingen månadsavgift. Inget kreditkort krävs.

## Relaterade guider

- [Fler sätt att använda Ticket Fairy](https://www.ticketfairy.com/features/api-and-developers)
- [Få en webhook varje gång du tar emot en biljettbeställning](https://www.ticketfairy.com/sv/guides/get-a-webhook-when-a-ticket-sells)
- [Sell tickets on your own website](https://www.ticketfairy.com/sv/guides/sell-tickets-on-your-own-website)
- [Bjud in ditt team till dina event och välj vad varje person kan göra](https://www.ticketfairy.com/sv/guides/invite-your-team)
- [Secure the account that runs your events](https://www.ticketfairy.com/sv/guides/secure-your-account)
- [Sell tickets in your own website or mobile app with the checkout SDK](https://www.ticketfairy.com/sv/guides/sell-tickets-in-your-own-website-or-app)
- [Alla Ticket Fairy-guider](https://www.ticketfairy.com/sv/guides)

## Gör det på ditt eget evenemang

Skapa ditt konto, bygg evenemanget och följ stegen i din egen kontrollpanel. Du behöver inte boka ett säljsamtal.

  [Skapa ett gratiskonto](https://manage.ticketfairy.com/welcome) [Boka en demo](https://www.ticketfairy.com/sv/event-ticketing/book-a-demo)

## Sälj biljetter med Ticket Fairy

Börja gratis med obegränsade evenemang och ingen månadsavgift, och välj en betald plan när du behöver mer.

- Sätt upp ditt evenemang på några minuter
- Gratisevenemang är gratis
- Fai, din AI-lagkamrat, är inbyggd

 [Skapa ett gratiskonto](https://manage.ticketfairy.com/welcome)

Inga startavgifter. Ingen månadsavgift. Inget kreditkort krävs.

## Se det i ett samtal

Boka en demo så visar vi hur Ticket Fairy hanterar din typ av evenemang.

 [Boka en demo](https://www.ticketfairy.com/sv/event-ticketing/book-a-demo) [Fler sätt att använda Ticket Fairy](https://www.ticketfairy.com/features/api-and-developers)

### Tips för att sälja fler biljetter

Praktiska råd från aktiva arrangörer, och varje ny guide så snart den publiceras.

Vi respekterar din integritet. Avsluta när du vill.
