Create a new API token
POSThttps://api.aleph-alpha.com/users/me/tokens
Create a new token to authenticate against the API with (the actual API token is only returned when calling this endpoint)
Request
- application/json
Bodyrequired
description stringrequired
a simple description to remember the token by
Example:
token used on my laptop
Responses
- 200
OK
- application/json
- Schema
- Example (auto)
Schema
metadata objectrequired
description stringrequired
the description you provided
token_id numberrequired
the ID of the API token
token stringrequired
the API token that can be used in the Authorization header
{
"metadata": {
"description": "string",
"token_id": 0
},
"token": "string"
}
Authorization: http
name: tokentype: httpscheme: bearerdescription: Can be generated in your [Aleph Alpha profile](https://app.aleph-alpha.com/profile)
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.aleph-alpha.com/users/me/tokens");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <TOKEN>");
var content = new StringContent("{\n \"description\": \"token used on my laptop\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear