Quickstart

Go from zero to your first API execution in five minutes

This guide walks you through authenticating, triggering a workflow execution, and retrieving the results.

Prerequisites

  • Your Client ID and Client Secret (provided by Further AI)
  • A Workflow ID for a workflow configured in your account
  • Python 3.8+ or cURL

Step 1 — Generate an Access Token

Exchange your client credentials for a bearer token.

1import requests
2
3TOKEN_URL = "https://api.further.ai/api/v1/oauth2/access_token"
4
5response = requests.post(TOKEN_URL, json={
6 "client_id": "YOUR_CLIENT_ID",
7 "client_secret": "YOUR_CLIENT_SECRET"
8})
9
10token_data = response.json()
11access_token = token_data["access_token"]
12print(f"Token: {access_token[:20]}...")

Tokens expire after 60 minutes. Your application should handle token refresh before expiry.

Step 2 — Trigger a Workflow Execution

Submit files to your workflow. The request format depends on your workflow’s file access configuration (see File Access Configuration).

The most common method is multipart form upload:

1import requests
2
3WORKFLOW_ID = "YOUR_WORKFLOW_ID"
4BASE_URL = "https://api.further.ai"
5
6url = f"{BASE_URL}/api/v1/workflow-builder/workflows/{WORKFLOW_ID}/executions"
7
8headers = {
9 "Authorization": f"Bearer {access_token}"
10}
11
12# Upload one or more files via multipart form
13files = [
14 ("files", ("policy.pdf", open("policy.pdf", "rb"), "application/pdf")),
15]
16
17response = requests.post(url, headers=headers, files=files)
18execution = response.json()
19
20execution_id = execution["workflow_execution_id"]
21print(f"Execution started: {execution_id}")

The response includes a workflow_execution_id you will use to poll for results:

1{
2 "workflow_execution_id": "abc123-def456-...",
3 "status": "running",
4 "message": "Execution triggered successfully"
5}

Step 3 — Poll for Results

Query the execution endpoint until the status is completed or failed.

1import time
2import requests
3
4WORKFLOW_ID = "YOUR_WORKFLOW_ID"
5BASE_URL = "https://api.further.ai"
6
7status_url = f"{BASE_URL}/api/v1/workflow-builder/workflows/{WORKFLOW_ID}/executions/{execution_id}"
8
9headers = {
10 "Authorization": f"Bearer {access_token}"
11}
12
13while True:
14 response = requests.get(status_url, headers=headers)
15 result = response.json()
16 status = result["status"]
17
18 print(f"Status: {status}")
19
20 if status in ("completed", "failed"):
21 break
22
23 time.sleep(5) # Wait 5 seconds before next poll
24
25if status == "completed":
26 print("Execution completed!")
27 for step in result.get("steps", []):
28 print(f" Step: {step['step_name']}")
29 print(f" Data: {step['data']}")
30else:
31 print(f"Execution failed: {result.get('error')}")

End-to-End Python Script

Here is a complete self-contained script you can copy and adapt:

1"""
2Further AI API — End-to-end quickstart
3"""
4import time
5import requests
6
7# ── Configuration ────────────────────────────────────────────
8CLIENT_ID = "YOUR_CLIENT_ID"
9CLIENT_SECRET = "YOUR_CLIENT_SECRET"
10WORKFLOW_ID = "YOUR_WORKFLOW_ID"
11FILE_PATH = "policy.pdf"
12BASE_URL = "https://api.further.ai"
13POLL_INTERVAL = 5 # seconds
14MAX_WAIT = 600 # seconds
15
16# ── 1. Authenticate ─────────────────────────────────────────
17print("Generating access token...")
18token_resp = requests.post(
19 f"{BASE_URL}/api/v1/oauth2/access_token",
20 json={"client_id": CLIENT_ID, "client_secret": CLIENT_SECRET}
21)
22token_resp.raise_for_status()
23access_token = token_resp.json()["access_token"]
24print(f" Token obtained (expires in 60 min)")
25
26headers = {"Authorization": f"Bearer {access_token}"}
27
28# ── 2. Trigger Execution ────────────────────────────────────
29print(f"Triggering execution for workflow {WORKFLOW_ID}...")
30with open(FILE_PATH, "rb") as f:
31 exec_resp = requests.post(
32 f"{BASE_URL}/api/v1/workflow-builder/workflows/{WORKFLOW_ID}/executions",
33 headers=headers,
34 files=[("files", (FILE_PATH, f, "application/pdf"))],
35 )
36exec_resp.raise_for_status()
37execution_id = exec_resp.json()["workflow_execution_id"]
38print(f" Execution ID: {execution_id}")
39
40# ── 3. Poll for Results ─────────────────────────────────────
41print("Polling for results...")
42status_url = f"{BASE_URL}/api/v1/workflow-builder/workflows/{WORKFLOW_ID}/executions/{execution_id}"
43elapsed = 0
44
45while elapsed < MAX_WAIT:
46 poll_resp = requests.get(status_url, headers=headers)
47 poll_resp.raise_for_status()
48 result = poll_resp.json()
49 status = result["status"]
50 print(f" [{elapsed}s] Status: {status}")
51
52 if status in ("completed", "failed"):
53 break
54
55 time.sleep(POLL_INTERVAL)
56 elapsed += POLL_INTERVAL
57
58# ── 4. Process Results ──────────────────────────────────────
59if status == "completed":
60 print("\nExecution completed successfully!\n")
61 for step in result.get("steps", []):
62 print(f"Step: {step['step_name']}")
63 print(f" Type: {step.get('step_type', 'N/A')}")
64 print(f" Data: {step.get('data', {})}")
65 print()
66elif status == "failed":
67 print(f"\nExecution failed: {result.get('error', 'Unknown error')}")
68else:
69 print(f"\nTimed out after {MAX_WAIT}s. Last status: {status}")

Next Steps