Get app (poll registration)
Returns a single app including registrationStatus, with reason and message explaining it. Stop polling on COMPLETED, COMPLETED_PARTIAL, NEEDS_INPUT, INTERRUPTED or CANCELLED.
curl --request GET \
--url https://api.perfai.ai/v1/apps/{appId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.perfai.ai/v1/apps/{appId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.perfai.ai/v1/apps/{appId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.perfai.ai/v1/apps/{appId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.perfai.ai/v1/apps/{appId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.perfai.ai/v1/apps/{appId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perfai.ai/v1/apps/{appId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"appId": "<string>",
"label": "<string>",
"appUrl": "<string>",
"basePath": "<string>",
"registrationStatus": "PENDING",
"reason": "needs_login",
"message": "We hit a snag — we're on it. Your results so far are saved.",
"createdAt": "2023-11-07T05:31:56Z",
"scheduleType": "nightly"
}{
"type": "<string>",
"title": "<string>"
}Authorizations
JWT login token tied to your Perfai user (not a separate API key). Obtain it via POST /api/v1/auth/token with your username and password (use the returned id_token) — the same login the web console performs. Carries org, user, and role; short-lived.
Path Parameters
MongoDB ObjectId of the app (from GET /apps or POST /apps).
Response
The app.
Onboarding state. Never FAILED.
NEEDS_INPUT — onboarding stopped and is waiting for something only you can supply (reason says what: needs_login, out_of_credits, app_unreachable, …). Answer a login pause with POST /v1/apps/{appId}/account-setup.
COMPLETED_PARTIAL — onboarding produced results, but part of it did not run (reason says why; needs_login means logged-in areas were not tested).
INTERRUPTED — onboarding stopped on our side before producing a result.
CANCELLED — a user stopped it.
COMPLETED, COMPLETED_PARTIAL, INTERRUPTED and CANCELLED are terminal. Stop polling on NEEDS_INPUT too: nothing changes until you act.
PENDING, IN_PROGRESS, NEEDS_INPUT, COMPLETED, COMPLETED_PARTIAL, INTERRUPTED, CANCELLED Why a task or app is in its state. Null when the state needs no explanation. New values may be added; show message for any you do not recognise.
needs_login, needs_roles, needs_access, needs_app_url, needs_spec, app_unreachable, out_of_credits, no_response, paused, partial_coverage, our_side_error, dependency_lost, null One sentence for the user — the same wording the console shows for this state.
"We hit a snag — we're on it. Your results so far are saved."
How often this app is re-tested automatically. Apps inherit your organization default at registration and fall back to nightly, so an app may be on a recurring cadence you did not request here — each run consumes credits. Change it in the console (Edit app); this API does not set it, matching the console prompt.
none, nightly, custom, weekly_saturday, biweekly_saturday, monthly_first "nightly"
curl --request GET \
--url https://api.perfai.ai/v1/apps/{appId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.perfai.ai/v1/apps/{appId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.perfai.ai/v1/apps/{appId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.perfai.ai/v1/apps/{appId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.perfai.ai/v1/apps/{appId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.perfai.ai/v1/apps/{appId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perfai.ai/v1/apps/{appId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"appId": "<string>",
"label": "<string>",
"appUrl": "<string>",
"basePath": "<string>",
"registrationStatus": "PENDING",
"reason": "needs_login",
"message": "We hit a snag — we're on it. Your results so far are saved.",
"createdAt": "2023-11-07T05:31:56Z",
"scheduleType": "nightly"
}{
"type": "<string>",
"title": "<string>"
}
