Auth & identity
End-user authentication as a service — users, sessions, JWT/JWKS verification, OAuth and GDPR/CCPA consent — on infrai's own self-built identity engine behind one key.
1. Overview
https://api.infrai.cc/v1/authAuthorization: Bearer $INFRAI_API_KEY# Call any /v1/auth capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/auth/... \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json"2. Methods (17)
2.1auth.user.create
Create an end-user identity on infrai's self-built auth engine. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | User email address.format: email |
password | string | Optional | Optional initial password (vendor-dependent). |
metadata | Record<string, unknown> | Optional | Arbitrary key/value metadata stored on the user. |
vendor | string | Optional | Optional explicit vendor pin. |
mode | "managed" | Optional | Provisioning mode — managed.default: "default_vendor" |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
AuthUser { user_id, email, email_verified, created_at }| Name | Type | Description |
|---|---|---|
user_id | string | User identifier associated with this resourcepattern: ^au_usr_[A-Za-z0-9]{20,}$ |
email | string | Email addressformat: email |
email_verified | boolean | Whether the email address has been verifieddefault: false |
phone | string | null | Phone number in E.164 format |
mfa_enabled | boolean | Whether multi-factor authentication is enabled for this userdefault: false |
created_at | string | ISO 8601 timestamp when this resource was createdformat: date-time |
last_login_at | string | null | ISO 8601 timestamp of the last successful loginformat: date-time |
metadata | object | null | Arbitrary key-value metadata attached to this resource |
vendor | string | null | Sticky: vendor of record for this user. |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/user/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/user/create",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'email': 'user@example.com'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"email": "user@example.com"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"email": "user@example.com"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"email": "user@example.com"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/user/create", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/user/create"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"email\": \"user@example.com\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/user/create");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"email\": \"user@example.com\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/user/create");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"email\": \"user@example.com\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/user/create")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"email": "user@example.com"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/user/create")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"email": "user@example.com"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.2auth.user.get
Fetch a single auth user by user_id.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id. |
Returns
AuthUser| Name | Type | Description |
|---|---|---|
user_id | string | User identifier associated with this resourcepattern: ^au_usr_[A-Za-z0-9]{20,}$ |
email | string | Email addressformat: email |
email_verified | boolean | Whether the email address has been verifieddefault: false |
phone | string | null | Phone number in E.164 format |
mfa_enabled | boolean | Whether multi-factor authentication is enabled for this userdefault: false |
created_at | string | ISO 8601 timestamp when this resource was createdformat: date-time |
last_login_at | string | null | ISO 8601 timestamp of the last successful loginformat: date-time |
metadata | object | null | Arbitrary key-value metadata attached to this resource |
vendor | string | null | Sticky: vendor of record for this user. |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/user/get/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/user/get/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/user/get/USER_ID", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/user/get/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/user/get/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/user/get/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/user/get/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/user/get/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.3auth.user.get_by_email
Look up an auth user by email address.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | User email address. |
Returns
AuthUser| Name | Type | Description |
|---|---|---|
user_id | string | User identifier associated with this resourcepattern: ^au_usr_[A-Za-z0-9]{20,}$ |
email | string | Email addressformat: email |
email_verified | boolean | Whether the email address has been verifieddefault: false |
phone | string | null | Phone number in E.164 format |
mfa_enabled | boolean | Whether multi-factor authentication is enabled for this userdefault: false |
created_at | string | ISO 8601 timestamp when this resource was createdformat: date-time |
last_login_at | string | null | ISO 8601 timestamp of the last successful loginformat: date-time |
metadata | object | null | Arbitrary key-value metadata attached to this resource |
vendor | string | null | Sticky: vendor of record for this user. |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/user/get_by_email \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/user/get_by_email",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get_by_email",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get_by_email",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/user/get_by_email", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/user/get_by_email"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/user/get_by_email");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/user/get_by_email");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/user/get_by_email")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/user/get_by_email")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.4auth.user.list
Cursor-paginated list of auth users for the account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | Opaque pagination cursor. |
limit | number | Optional | Maximum number of items to return. |
Returns
{ items: AuthUser[], next_cursor?: string }| Name | Type | Description |
|---|---|---|
items | object[] | List of user records |
next_cursor | string | null | Cursor for next page; null if last page |
total | integer | Number of items in this page |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/user/list \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/user/list",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/user/list", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/user/list"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/user/list");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/user/list");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/user/list")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/user/list")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.5auth.user.update
Update mutable fields (metadata, phone, MFA) of an existing auth user. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
metadata | Record<string, unknown> | Optional | Arbitrary key/value metadata stored on the user. |
email_verified | boolean | Optional | Mark the user email as verified. |
mfa_enabled | boolean | Optional | Enable or disable MFA for the user. |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
AuthUser| Name | Type | Description |
|---|---|---|
user_id | string | User identifier associated with this resourcepattern: ^au_usr_[A-Za-z0-9]{20,}$ |
email | string | Email addressformat: email |
email_verified | boolean | Whether the email address has been verifieddefault: false |
phone | string | null | Phone number in E.164 format |
mfa_enabled | boolean | Whether multi-factor authentication is enabled for this userdefault: false |
created_at | string | ISO 8601 timestamp when this resource was createdformat: date-time |
last_login_at | string | null | ISO 8601 timestamp of the last successful loginformat: date-time |
metadata | object | null | Arbitrary key-value metadata attached to this resource |
vendor | string | null | Sticky: vendor of record for this user. |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X PATCH https://api.infrai.cc/v1/auth/user/update/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.patch(
"https://api.infrai.cc/v1/auth/user/update/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/update/USER_ID",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/update/USER_ID",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"user_id": "sample"}`)
req, _ := http.NewRequest("PATCH", "https://api.infrai.cc/v1/auth/user/update/USER_ID", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/user/update/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\"user_id\": \"sample\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("PATCH"), "https://api.infrai.cc/v1/auth/user/update/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"user_id\": \"sample\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/user/update/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"user_id\": \"sample\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/user/update/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Patch.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"user_id": "sample"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.patch("https://api.infrai.cc/v1/auth/user/update/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"user_id": "sample"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.6auth.user.delete
Delete an auth user and cascade-revoke its sessions. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id. |
Returns
{ ok: boolean }| Name | Type | Description |
|---|---|---|
ok | boolean | Whether the user was deleted |
user_id | string | null | Identifier of the deleted user |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X DELETE https://api.infrai.cc/v1/auth/user/delete/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/auth/user/delete/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/delete/USER_ID",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/delete/USER_ID",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("DELETE", "https://api.infrai.cc/v1/auth/user/delete/USER_ID", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/user/delete/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("DELETE"), "https://api.infrai.cc/v1/auth/user/delete/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/user/delete/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/user/delete/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Delete.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.delete("https://api.infrai.cc/v1/auth/user/delete/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.7auth.session.create
Mint an authenticated session for a user. May return AUTH_MFA_REQUIRED. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
method | string | Optional | Authentication method used for the session.default: "password" |
mfa_factor | string | Optional | MFA factor / code when require_mfa is set. |
require_mfa | boolean | Optional | Require an MFA factor to issue the session.default: false |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
Session { session_id, access_token, refresh_token, expires_at }| Name | Type | Description |
|---|---|---|
challenge_id | string | Identifier for the authentication challenge |
method | "password" | "magic_link" | "otp" | "oauth" | "passkey" | Authentication method used (e.g. email_otp, oauth, password) |
redirect_uri | string | null | For oauth method. |
expires_at | string | ISO 8601 timestamp when this resource or token expiresformat: date-time |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/session/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/session/create",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"user_id": "sample"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/session/create", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/session/create"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"user_id\": \"sample\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/session/create");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"user_id\": \"sample\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/session/create");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"user_id\": \"sample\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/session/create")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"user_id": "sample"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/session/create")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"user_id": "sample"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.8auth.session.verify
Verify a session_id / JWT against the infrai JWKS and return the Session.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | The session id. |
Returns
{ valid: boolean, user_id?, expires_at? }| Name | Type | Description |
|---|---|---|
session_id | string | Unique identifier for this session |
user_id | string | User identifier associated with this resourcepattern: ^au_usr_[A-Za-z0-9]{20,}$ |
started_at | string | ISO 8601 timestamp when execution startedformat: date-time |
expires_at | string | ISO 8601 timestamp when this resource or token expiresformat: date-time |
ip | string | null | IP address from which the session was created |
ua | string | null | User-Agent string from the session creation request |
mfa_factor | string | null | Active MFA factor (see enums/AuthFactor). |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/session/verify/SESSION_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/session/verify/SESSION_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/verify/SESSION_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/verify/SESSION_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/session/verify/SESSION_ID", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/session/verify/SESSION_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/session/verify/SESSION_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/session/verify/SESSION_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/session/verify/SESSION_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/session/verify/SESSION_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.9auth.session.refresh
Exchange a refresh token for a new session; enforces 5-min cooldown (AUTH_REFRESH_TOO_FREQUENT). Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
refresh_token | string | Required | A valid refresh token to exchange for a new session.≥ 1 chars |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
Session| Name | Type | Description |
|---|---|---|
access_token | string | Short-lived access token for API authentication |
refresh_token | string | Long-lived token used to obtain new access tokens |
expires_in | integer | Seconds until access_token expiry.≥ 1 |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/session/refresh \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"refresh_token": "sample"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/session/refresh",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'refresh_token': 'sample'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/refresh",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"refresh_token": "sample"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/refresh",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"refresh_token": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"refresh_token": "sample"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/session/refresh", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/session/refresh"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"refresh_token\": \"sample\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/session/refresh");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"refresh_token\": \"sample\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/session/refresh");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"refresh_token\": \"sample\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/session/refresh")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"refresh_token": "sample"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/session/refresh")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"refresh_token": "sample"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.10auth.session.revoke
Revoke a single session by session_id. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | The session id.≥ 1 chars |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
{ ok: boolean }| Name | Type | Description |
|---|---|---|
ok | boolean | Whether the session was revoked |
count | integer | Number of sessions revoked (auth.session.revoke_all_for_user only) |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"session_id": "sample"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'session_id': 'sample'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"session_id": "sample"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"session_id": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"session_id": "sample"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"session_id\": \"sample\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"session_id\": \"sample\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"session_id\": \"sample\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"session_id": "sample"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/session/revoke/SESSION_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"session_id": "sample"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.11auth.session.revoke_all_for_user
Revoke all active sessions for a user (e.g. password reset / logout-everywhere). Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
except_session_id | string | Optional | Keep this session; revoke all others. |
Returns
{ revoked: number }| Name | Type | Description |
|---|---|---|
ok | boolean | Whether the session was revoked |
count | integer | Number of sessions revoked (auth.session.revoke_all_for_user only) |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"user_id": "sample"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"user_id\": \"sample\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"user_id\": \"sample\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"user_id\": \"sample\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"user_id": "sample"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/session/revoke_all_for_user/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"user_id": "sample"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.12auth.session.list_for_user
List active sessions for a given user.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id. |
Returns
{ items: Session[] }| Name | Type | Description |
|---|---|---|
items | object[] | List of session records |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/session/list_for_user/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.13auth.consent.grant
Record a GDPR/CCPA consent grant for a user/category. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
category | string | Required | Consent category, e.g. marketing or analytics. |
source | string | Optional | How the consent was captured.default: "explicit" |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
{ ok: boolean }| Name | Type | Description |
|---|---|---|
ok | boolean | Whether the operation succeeded |
consent_id | string | Identifier of the consent record (auth.consent.grant only) |
user_id | string | User identifier |
category | string | Consent category affected |
granted | boolean | Whether consent is granted (auth.consent.grant only) |
granted_at | string | null | ISO 8601 timestamp when consent was granted (auth.consent.grant only) |
revoked_at | string | null | ISO 8601 timestamp when consent was revoked, if any (auth.consent.grant only) |
source | string | How consent was captured, e.g. 'explicit' (auth.consent.grant only) |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/consent/grant/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample", "category": "marketing"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/consent/grant/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample', 'category': 'marketing'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/grant/USER_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample", "category": "marketing"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/grant/USER_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample", "category": "marketing"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"user_id": "sample", "category": "marketing"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/consent/grant/USER_ID", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/consent/grant/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"user_id\": \"sample\", \"category\": \"marketing\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/consent/grant/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"user_id\": \"sample\", \"category\": \"marketing\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/consent/grant/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"user_id\": \"sample\", \"category\": \"marketing\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/consent/grant/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"user_id": "sample", "category": "marketing"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/consent/grant/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"user_id": "sample", "category": "marketing"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.14auth.consent.revoke
Revoke a previously granted consent for a user/category. Accepts idempotency_key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
category | string | Required | Consent category, e.g. marketing or analytics. |
idempotency_key | string | Optional | Client-supplied key to make the call idempotent. |
Returns
{ ok: boolean }| Name | Type | Description |
|---|---|---|
ok | boolean | Whether the operation succeeded |
consent_id | string | Identifier of the consent record (auth.consent.grant only) |
user_id | string | User identifier |
category | string | Consent category affected |
granted | boolean | Whether consent is granted (auth.consent.grant only) |
granted_at | string | null | ISO 8601 timestamp when consent was granted (auth.consent.grant only) |
revoked_at | string | null | ISO 8601 timestamp when consent was revoked, if any (auth.consent.grant only) |
source | string | How consent was captured, e.g. 'explicit' (auth.consent.grant only) |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/consent/revoke/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample", "category": "marketing"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/consent/revoke/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample', 'category': 'marketing'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/revoke/USER_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample", "category": "marketing"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/revoke/USER_ID",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample", "category": "marketing"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"user_id": "sample", "category": "marketing"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/consent/revoke/USER_ID", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/consent/revoke/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"user_id\": \"sample\", \"category\": \"marketing\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/consent/revoke/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"user_id\": \"sample\", \"category\": \"marketing\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/consent/revoke/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"user_id\": \"sample\", \"category\": \"marketing\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/consent/revoke/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"user_id": "sample", "category": "marketing"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/consent/revoke/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"user_id": "sample", "category": "marketing"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.15auth.consent.check
Check whether a user currently holds consent for a given category (boolean).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id. |
category | string | Required | Consent category, e.g. marketing or analytics. |
Returns
{ granted: boolean, source?, granted_at? }| Name | Type | Description |
|---|---|---|
result | boolean | Whether consent is currently granted for this user/category |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/consent/check/USER_ID/CATEGORY")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.16auth.consent.list_for_user
List all consent records for a user across GDPR categories.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | The user id. |
Returns
{ items: Array<{ category, granted, source?, granted_at? }> }| Name | Type | Description |
|---|---|---|
items | object[] | List of consent records |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X GET https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("GET"), "https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.get("https://api.infrai.cc/v1/auth/consent/list_for_user/USER_ID")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}2.17auth.identity.resolve
Resolve-or-create a unified end-user from a third-party identity you've already verified — the tenant-vouched model (Auth0/Clerk-style). For native Sign in with Apple: your backend verifies Apple's identityToken (signature against Apple's JWKS, iss/aud), then calls this with the Apple sub to bind and return a stable infrai user. Idempotent: the same (provider, value) always resolves to the same user_id. No infrai-side per-app registration is required.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
type | "external" | "email" | "phone" | Required | Identity kind: "external" (a third-party provider subject), "email", or "phone".e.g. email |
value | string | Required | The identity value — for external, the provider subject (e.g. the Apple `sub`).e.g. user@example.com |
provider | string | Optional | Provider for an external identity, e.g. "apple", "google", "wechat". |
create | boolean | Optional | Whether to create a new identity if none matches.default: true |
verified | boolean | Optional | Mark the identity as proven — set true once your backend has verified the provider token. |
account_id | string | Optional | The account id to associate with the resolved identity. |
Returns
{ user: AuthUser, identity: Identity, created: boolean }| Name | Type | Description |
|---|---|---|
user | object | The resolved end-user record |
identity | object | The matched identity record (type/provider/value/user_id/verified/created_at) |
created | boolean | Whether a new user was minted by this call (auth.identity.resolve only) |
Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."curl -X POST https://api.infrai.cc/v1/auth/identity/resolve \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type": "email", "value": "user@example.com"}'# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/identity/resolve",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'type': 'email', 'value': 'user@example.com'},
)
resp.raise_for_status()
print(resp.json())// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/identity/resolve",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"type": "email", "value": "user@example.com"}),
},
);
console.log(await resp.json());// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/identity/resolve",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"type": "email", "value": "user@example.com"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);// Zero-install REST call — no SDK required (short-term the API is REST-only).
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := []byte(`{"type": "email", "value": "user@example.com"}`)
req, _ := http.NewRequest("POST", "https://api.infrai.cc/v1/auth/identity/resolve", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}// Zero-install REST call — no SDK required (short-term the API is REST-only).
import java.net.URI;
import java.net.http.*;
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.infrai.cc/v1/auth/identity/resolve"))
.header("Authorization", "Bearer " + System.getenv("INFRAI_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"type\": \"email\", \"value\": \"user@example.com\"}"))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());// Zero-install REST call — no SDK required (short-term the API is REST-only).
using System;
using System.Net.Http;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://api.infrai.cc/v1/auth/identity/resolve");
var key = Environment.GetEnvironmentVariable("INFRAI_API_KEY");
req.Headers.Add("Authorization", "Bearer " + key);
req.Content = new StringContent("{\"type\": \"email\", \"value\": \"user@example.com\"}", System.Text.Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());<?php
// Zero-install REST call — no SDK required (short-term the API is REST-only).
$ch = curl_init("https://api.infrai.cc/v1/auth/identity/resolve");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("INFRAI_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"type\": \"email\", \"value\": \"user@example.com\"}");
$response = curl_exec($ch);
curl_close($ch);
echo $response;# Zero-install REST call — no SDK required (short-term the API is REST-only).
require "net/http"
require "uri"
uri = URI("https://api.infrai.cc/v1/auth/identity/resolve")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['INFRAI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = '{"type": "email", "value": "user@example.com"}'
res = http.request(req)
puts res.body// Zero-install REST call — no SDK required (short-term the API is REST-only). (uses the reqwest + tokio crates)
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::Client::new()
.post("https://api.infrai.cc/v1/auth/identity/resolve")
.header("Authorization", format!("Bearer {}", env::var("INFRAI_API_KEY")?))
.header("Content-Type", "application/json")
.body(r#"{"type": "email", "value": "user@example.com"}"#)
.send()
.await?;
println!("{}", resp.text().await?);
Ok(())
}Advanced: pin a vendor
By default infrai routes each call to the best available provider — you do not pick a vendor. As an escape hatch, this capability accepts an optional vendor parameter to pin one specific provider. Every live vendor for this capability is available in real time from the discovery endpoint for the capability id — see the discovery API.
GET /v1/discovery/{capability}auth.user.create
3. All capabilities
Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.
auth.consent.checkGET /v1/auth/consent/check/{user_id}/{category}Check whether a user currently holds consent for a given category (boolean).
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
category | string | Required | Path parameter. |
user_id | string | Required | Path parameter. |
auth.consent.grantPOST /v1/auth/consent/grant/{user_id}Record a GDPR/CCPA consent grant for a user/category. Accepts idempotency_key.
Parameters (4)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path param.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
category | "marketing" | "analytics" | "essential" | "third_party" | Required | Consent category (e.g. marketing, analytics) |
source | string | Optional | How consent was captured.default: "explicit" |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.consent.list_for_userGET /v1/auth/consent/list_for_user/{user_id}List all consent records for a user across GDPR categories.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path parameter. |
auth.consent.revokePOST /v1/auth/consent/revoke/{user_id}Revoke a previously granted consent for a user/category. Accepts idempotency_key.
Parameters (3)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path param.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
category | "marketing" | "analytics" | "essential" | "third_party" | Required | Consent category (e.g. marketing, analytics) |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.email.change_confirmPOST /v1/auth/email/change_confirmConfirm an email change with the single-use token from the new address; switches the user's email. Returns AUTH_TOKEN_REUSED on replay. Accepts idempotency_key.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
token | string | Required | Authentication or verification token≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.email.change_requestPOST /v1/auth/email/change_requestStart an email change for a user; sends a single-use signed verification token to the NEW address (self-built, no BYOK). Accepts idempotency_key.
Parameters (3)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | User identifier associated with this resource≥ 1 chars |
new_email | string | Required | New email address; the signed verification link is sent here.≥ 3 charsformat: email |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.email.send_codePOST /v1/auth/email/send_codeSend a short-lived single-use email OTP to a user for verification or passwordless login (self-built). Accepts idempotency_key.
Parameters (4)
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | Email address≥ 3 charsformat: email |
purpose | "verify" | "login" | Optional | Purpose of the DNS recorddefault: "verify" |
locale | string | Optional | End-user's current language (BCP-47, e.g. 'zh-CN' / 'en'); the OTP email is rendered in it (zh/en supported, default en). Pass your app's UI locale so the code reaches the user in their language.e.g. zh-CN |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.email.verifyPOST /v1/auth/email/verifyVerify an email OTP AND log in: on success resolves-or-creates the unified user (passwordless signup) and mints a session, returning {verified, user_id, created, session_id, access_token, refresh_token, expires_at} — a one-call login matching Auth0/Clerk/Supabase verifyOtp. Pass login=false for a bare code-check. Wrong/expired returns AUTH_CODE_INVALID. Accepts idempotency_key.
Parameters (3)
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | Email address≥ 3 charsformat: email |
code | string | Required | Authorization code from the OAuth provider≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.identity.addPOST /v1/auth/identity/add/{user_id}Bind an additional login identity (email/phone/external) to an existing user. Idempotent if already this user's; IDENTITY_ALREADY_LINKED if another user owns it (no auto-merge).
Parameters (7)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path parameter. |
type | "email" | "phone" | "external" | Required | Identity kind.e.g. email |
value | string | Required | The identity address/subject — an email, an E.164 phone, or a provider subject id (must match `type`).e.g. user@example.com |
provider | string | null | Optional | For type=external: the provider id (e.g. wechat, google, github). |
create | boolean | null | Optional | resolve(): create a unified user when none matches (default true).default: true |
verified | boolean | null | Optional | Mark the identity verified on attach (e.g. a tenant-vouched external subject). |
account_id | string | null | Optional | Tenant scope (defaults to the authenticated account). |
auth.identity.getPOST /v1/auth/identity/getLook up the end-user that owns a given identity (email/phone/external subject) without creating one; returns IDENTITY_NOT_FOUND if unknown.
Parameters (6)
| Name | Type | Required | Description |
|---|---|---|---|
type | "email" | "phone" | "external" | Required | Identity kind.e.g. email |
value | string | Required | The identity address/subject — an email, an E.164 phone, or a provider subject id (must match `type`).e.g. user@example.com |
provider | string | null | Optional | For type=external: the provider id (e.g. wechat, google, github). |
create | boolean | null | Optional | resolve(): create a unified user when none matches (default true).default: true |
verified | boolean | null | Optional | Mark the identity verified on attach (e.g. a tenant-vouched external subject). |
account_id | string | null | Optional | Tenant scope (defaults to the authenticated account). |
auth.identity.listGET /v1/auth/identity/list/{user_id}List every login identity (email/phone/external) attached to a user.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path parameter. |
auth.identity.removeDELETE /v1/auth/identity/remove/{user_id}/{identity_id}Unlink one identity from a user; refuses IDENTITY_LAST_REMAINING when it is the user's only remaining identity.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
identity_id | string | Required | Path parameter. |
user_id | string | Required | Path parameter. |
auth.identity.resolvePOST /v1/auth/identity/resolveUnified login/register: resolve a (tenant-vouched) email, phone, or external-provider identity to its end-user, minting the user + identity if unknown. type=external + provider (e.g. 'wechat') + value=<subject> handles any third-party login; one person who arrives via different identities maps to the SAME user_id.
Parameters (6)
| Name | Type | Required | Description |
|---|---|---|---|
type | "email" | "phone" | "external" | Required | Identity kind.e.g. email |
value | string | Required | The identity address/subject — an email, an E.164 phone, or a provider subject id (must match `type`).e.g. user@example.com |
provider | string | null | Optional | For type=external: the provider id (e.g. wechat, google, github). |
create | boolean | null | Optional | resolve(): create a unified user when none matches (default true).default: true |
verified | boolean | null | Optional | Mark the identity verified on attach (e.g. a tenant-vouched external subject). |
account_id | string | null | Optional | Tenant scope (defaults to the authenticated account). |
auth.oauth.authorize_urlGET /v1/auth/oauth/authorize_urlBuild the provider authorize URL (provider must be one of the enabled set — see auth.oauth.providers) with state, nonce and PKCE challenge; return_to/redirect_uri must be in the account's registered allowlist.
Parameters (3)
| Name | Type | Required | Description |
|---|---|---|---|
provider | "google" | "github" | "apple" | "facebook" | Required | OAuth provider name (e.g. google, github) |
return_to | string | null | Optional | Unified-brand transit (preferred): final web URL or app deep link to 302 back to after Infrai's transit endpoint completes the flow. Must be in the account's allowlist.e.g. https://app.example.com/auth/done |
redirect_uri | string | null | Optional | Legacy customer-BFF: the caller's own provider redirect URI (used when `return_to` is absent). Must be in the account's allowlist.format: urie.g. https://app.example.com/oauth/callback |
auth.oauth.callbackPOST /v1/auth/oauth/callbackComplete the OAuth flow: validate state + redirect_uri, exchange the code, link/create the user and mint a session. Honest typed error if the provider is not configured.
Parameters (6)
| Name | Type | Required | Description |
|---|---|---|---|
provider | "google" | "github" | "apple" | "facebook" | Required | OAuth provider name (e.g. google, github) |
code | string | Required | Authorization code from the OAuth provider≥ 1 chars |
state | string | Required | Current lifecycle state of this resource≥ 1 chars |
redirect_uri | string | Required | Redirect URI registered with the OAuth provider≥ 1 charsformat: uri |
code_verifier | string | null | Optional | PKCE verifier matching the challenge from authorize_url. |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.oauth.providersGET /v1/auth/oauth/providersList the OAuth providers an end user can sign in with right now, each flagged ready (real client_id configured), plus the unified consent-screen brand. The runtime companion to the AuthProvider enum in discovery.
No request parameters.
auth.password.changePOST /v1/auth/password/changeChange a user's password after verifying the current one (AUTH_INVALID_CREDENTIALS on mismatch); argon2id re-hash. Accepts idempotency_key.
Parameters (4)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | User identifier associated with this resource≥ 1 chars |
current_password | string | Required | Current password for verification≥ 1 chars |
new_password | string | Required | New password for the account≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.password.reset_confirmPOST /v1/auth/password/reset_confirmConfirm a password reset with {email, code, new_password} — verifies the 6-digit code from reset_request, re-hashes (argon2id) and revokes all sessions. Wrong/expired code returns AUTH_CODE_INVALID; weak password returns AUTH_PASSWORD_TOO_WEAK. Accepts idempotency_key.
Parameters (4)
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | Email addressformat: email |
code | string | Required | Authorization code from the OAuth provider4–8 chars |
new_password | string | Required | New password for the account≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.password.reset_requestPOST /v1/auth/password/reset_requestRequest a password reset (code-style, Supabase pattern); always returns 200 (no user-existence leak) and emails a single-use 6-digit code when the email is known. Accepts idempotency_key.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | Email address≥ 3 charsformat: email |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.phone.send_codePOST /v1/auth/phone/send_codeSend a short-lived single-use phone (SMS) OTP to a user (self-built; SMS delivery depends on infra.sms). Accepts idempotency_key.
Parameters (4)
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | Phone number in E.164 format≥ 3 chars |
purpose | "verify" | "login" | Optional | Purpose of the DNS recorddefault: "verify" |
locale | string | Optional | End-user's current language (BCP-47, e.g. 'zh-CN' / 'en'); the OTP SMS is rendered in it (zh/en supported, default en). Pass your app's UI locale so the code reaches the user in their language.e.g. zh-CN |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.phone.verifyPOST /v1/auth/phone/verifyVerify a phone OTP AND log in: on success resolves-or-creates the unified user (passwordless signup) and mints a session, returning {verified, user_id, created, session_id, access_token, refresh_token, expires_at} — a one-call login matching Auth0/Clerk/Supabase. Pass login=false for a bare code-check. Wrong/expired returns AUTH_CODE_INVALID. Accepts idempotency_key.
Parameters (3)
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | Phone number in E.164 format≥ 3 chars |
code | string | Required | Authorization code from the OAuth provider≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.session.createPOST /v1/auth/session/createMint an authenticated session for a user; routes to the user's pinned vendor. May return AUTH_MFA_REQUIRED. Accepts idempotency_key.
Parameters (5)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | User identifier associated with this resourcepattern: ^au_usr_[A-Za-z0-9]{20,}$ |
method | "password" | "magic_link" | "otp" | "oauth" | "passkey" | Optional | Authentication method used (e.g. email_otp, oauth, password)default: "password" |
mfa_factor | string | null | Optional | MFA factor / code when require_mfa. |
require_mfa | boolean | Optional | Whether MFA is required to complete authenticationdefault: false |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.session.list_for_userGET /v1/auth/session/list_for_user/{user_id}List active sessions for a given user.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path parameter. |
auth.session.refreshPOST /v1/auth/session/refreshExchange a refresh token for a new session; enforces 5-min cooldown (AUTH_REFRESH_TOO_FREQUENT). Accepts idempotency_key.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
refresh_token | string | Required | Long-lived token used to obtain new access tokens≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.session.revokePOST /v1/auth/session/revoke/{session_id}Revoke a single session by session_id. Accepts idempotency_key.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Path param; the session to revoke.≥ 1 chars |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.session.revoke_all_for_userPOST /v1/auth/session/revoke_all_for_user/{user_id}Revoke all active sessions for a user (e.g. password reset / logout-everywhere). Accepts idempotency_key.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path param; revoke all this user's active sessions.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
except_session_id | string | null | Optional | Keep this one session alive (e.g. the current browser). |
auth.session.verifyGET /v1/auth/session/verify/{session_id}Verify a session_id / JWT against the vendor JWKS (RS256+ES256) and return the Session.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Path parameter. |
auth.token.jwksGET /v1/auth/token/jwksReturn the public JWKS (EdDSA) for offline verification of Infrai-issued access JWTs — clients verify tokens with zero round-trips.
No request parameters.
auth.user.createPOST /v1/auth/user/createCreate an auth user across a vendor (Clerk/WorkOS/Supabase Auth). Pins the vendor of record (sticky-on-resource). Accepts idempotency_key.
Parameters (6)
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | Email addressformat: email |
password | string | null | Optional | Optional initial password (vendor-dependent). |
metadata | object | null | Optional | Arbitrary key-value metadata attached to this resource |
vendor | "infrai_native" | null | Optional | Explicit vendor pin (auth is self-operated: infrai_native only). |
mode | "default_vendor" | "verified_account" | Optional | Delivery mode or operation modedefault: "default_vendor" |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
auth.user.deleteDELETE /v1/auth/user/delete/{user_id}Delete an auth user and cascade-revoke its sessions. Accepts idempotency_key.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path parameter. |
auth.user.getGET /v1/auth/user/get/{user_id}Fetch a single auth user by user_id from its pinned vendor.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path parameter. |
auth.user.get_by_emailGET /v1/auth/user/get_by_emailLook up an auth user by email address.
No request parameters.
auth.user.listGET /v1/auth/user/listCursor-paginated list of auth users for the account.
No request parameters.
auth.user.updatePATCH /v1/auth/user/update/{user_id}Update mutable fields (metadata, phone, MFA) of an existing auth user. Accepts idempotency_key.
Parameters (5)
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Required | Path param; the user to update.pattern: ^au_usr_[A-Za-z0-9]{20,}$ |
metadata | object | null | Optional | Arbitrary key-value metadata attached to this resource |
email_verified | boolean | null | Optional | Whether the email address has been verified |
mfa_enabled | boolean | null | Optional | Whether multi-factor authentication is enabled for this user |
idempotency_key | string | null | Optional | Client-provided idempotency key; prevents duplicate execution on retry |
4. End-to-end example
A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.
A copy-paste-runnable single-file Python program (stdlib only, no SDK): set your INFRAI_API_KEY, run it, and walk this module's core flow with REAL billed calls — later steps reuse real fields returned by earlier ones. The 12-line helper is the entire integration.
#!/usr/bin/env python3
"""Infrai · auth — runnable real-app example (single file, zero deps).
Copy this file, set your key, run it: every step is a REAL call to
api.infrai.cc, billed at the real (tiny) per-call price, printing the
live JSON response. Get a key at https://infrai.cc/login (Google/
GitHub sign-in grants $2 free credit); add funds at
https://infrai.cc/billing. No SDK — the 12-line helper below is the
entire integration."""
import json
import os
from urllib import error, request
KEY = os.environ.get("INFRAI_API_KEY") or "ifr_..." # <- your key
BASE = "https://api.infrai.cc"
# Same raw HTTPS POST/GET as every per-method example on this page —
# wrapped once for reuse. There is nothing else to it: no SDK.
def infrai(method, path, body=None):
req = request.Request(
BASE + path, method=method,
data=json.dumps(body).encode() if body is not None else None,
headers={"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json"})
try:
with request.urlopen(req, timeout=60) as r:
return json.loads(r.read())
except error.HTTPError as e:
return json.loads(e.read())
def show(label, resp):
print(f"\n== {label} ==")
print(json.dumps(resp, indent=2, ensure_ascii=False))
return resp
# 1) auth.user.create — POST /v1/auth/user/create · Create an auth user across a vendor (Clerk/WorkOS/Supabase Auth). Pins the vendor of record (sticky-on-resource). Accepts idempotency_key.
r1 = show("auth.user.create", infrai("POST", "/v1/auth/user/create", {"email":"user@example.com"}))
# 2) auth.session.create — POST /v1/auth/session/create · Mint an authenticated session for a user; routes to the user's pinned vendor. May return AUTH_MFA_REQUIRED. Accepts idempotency_key.
r2 = show("auth.session.create", infrai("POST", "/v1/auth/session/create", {"user_id":"sample"}))
# 3) auth.user.get_by_email — GET /v1/auth/user/get_by_email · Look up an auth user by email address.
r3 = show("auth.user.get_by_email", infrai("GET", "/v1/auth/user/get_by_email"))
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
# only your project key. No SDK, no install.
# Get your key: sign in with Google/GitHub at https://infrai.cc/login for a
# project key + $2 free credit (email sign-in starts at $0). On 402
# INSUFFICIENT_CREDIT, add funds at https://infrai.cc/billing (or POST
# /v1/account/topup and open the returned checkout_url).
export INFRAI_API_KEY="ifr_..." # from https://infrai.cc/login
# 2) auth.user.create
curl -X POST https://api.infrai.cc/v1/auth/user/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'
# 3) auth.user.get
curl -X GET https://api.infrai.cc/v1/auth/user/get/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 4) auth.user.get_by_email
curl -X GET https://api.infrai.cc/v1/auth/user/get_by_email \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 5) auth.user.list
curl -X GET https://api.infrai.cc/v1/auth/user/list \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 6) auth.user.update
curl -X PATCH https://api.infrai.cc/v1/auth/user/update/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample"}'
# 7) auth.user.delete
curl -X DELETE https://api.infrai.cc/v1/auth/user/delete/USER_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 8) auth.session.create
curl -X POST https://api.infrai.cc/v1/auth/session/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "sample"}'
# 9) auth.session.verify
curl -X GET https://api.infrai.cc/v1/auth/session/verify/SESSION_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 1) Auth: every call is a raw HTTPS request carrying only your project key.
# No SDK to install — just the `requests` library.
import os, requests
BASE = "https://api.infrai.cc"
HEADERS = {
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
"Content-Type": "application/json",
}
# 2) auth.user.create
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/user/create",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'email': 'user@example.com'},
)
resp.raise_for_status()
print(resp.json())
# 3) auth.user.get
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/user/get/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())
# 4) auth.user.get_by_email
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/user/get_by_email",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())
# 5) auth.user.list
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/user/list",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())
# 6) auth.user.update
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.patch(
"https://api.infrai.cc/v1/auth/user/update/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample'},
)
resp.raise_for_status()
print(resp.json())
# 7) auth.user.delete
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/auth/user/delete/USER_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())
# 8) auth.session.create
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/auth/session/create",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
json={'user_id': 'sample'},
)
resp.raise_for_status()
print(resp.json())
# 9) auth.session.verify
# Zero-install REST call — no SDK required (short-term the API is REST-only).
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/auth/session/verify/SESSION_ID",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
},
)
resp.raise_for_status()
print(resp.json())
// 1) Auth: every call is a raw HTTPS request carrying only your project key.
// No SDK to install — just the built-in fetch().
const BASE = "https://api.infrai.cc";
const HEADERS = {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
};
// 2) auth.user.create
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"email": "user@example.com"}),
},
);
console.log(await resp.json());
// 3) auth.user.get
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 4) auth.user.get_by_email
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get_by_email",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 5) auth.user.list
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 6) auth.user.update
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/update/USER_ID",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
console.log(await resp.json());
// 7) auth.user.delete
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/delete/USER_ID",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 8) auth.session.create
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
console.log(await resp.json());
// 9) auth.session.verify
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/verify/SESSION_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 1) Auth: every call is a raw HTTPS request carrying only your project key.
// No SDK to install — just the built-in fetch(), typed.
const BASE = "https://api.infrai.cc";
const HEADERS: Record<string, string> = {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
};
// 2) auth.user.create
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"email": "user@example.com"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 3) auth.user.get
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get/USER_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 4) auth.user.get_by_email
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/get_by_email",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 5) auth.user.list
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 6) auth.user.update
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/update/USER_ID",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 7) auth.user.delete
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/user/delete/USER_ID",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 8) auth.session.create
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"user_id": "sample"}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 9) auth.session.verify
// Zero-install REST call — no SDK required (short-term the API is REST-only).
const resp = await fetch(
"https://api.infrai.cc/v1/auth/session/verify/SESSION_ID",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);