Manage Line Request
curl --request POST \
--url https://app.tuco.ai/api/line-requests/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/line-requests/{id}"
payload = { "action": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: '<string>'})
};
fetch('https://app.tuco.ai/api/line-requests/{id}', 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://app.tuco.ai/api/line-requests/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.tuco.ai/api/line-requests/{id}"
payload := strings.NewReader("{\n \"action\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.tuco.ai/api/line-requests/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/line-requests/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyLines & Leads
Manage Line Request
Cancel a pending Tuco line request or recover its Stripe payment link. Bearer-token REST endpoint.
POST
/
api
/
line-requests
/
{id}
Manage Line Request
curl --request POST \
--url https://app.tuco.ai/api/line-requests/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/line-requests/{id}"
payload = { "action": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: '<string>'})
};
fetch('https://app.tuco.ai/api/line-requests/{id}', 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://app.tuco.ai/api/line-requests/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.tuco.ai/api/line-requests/{id}"
payload := strings.NewReader("{\n \"action\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.tuco.ai/api/line-requests/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/line-requests/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyThis endpoint supports small request-management actions. It does not create a new line request.
When To Use This Endpoint
Use this endpoint when the request already exists and the user asks one of these questions:- “I lost the payment link. Can I get it again?”
- “I changed my mind. Can I cancel this unpaid request?”
Authentication
Pass your workspace API key as a Bearer token, or use a Clerk session token.Authorization: Bearer tuco_xxxxxxxxxxxxx
Path parameter
string
required
The line request id returned by
POST /api/line-requests — it is the line._id value in that response.A line request is not a separate record: it is the line itself, created with requestSource: "api". The request id and the line id are therefore the same value. Unlike GET /api/line-requests/{id}, which reads any line in your workspace, these two actions run only against API-created requests — a line created in the dashboard returns 404 Line request not found.Request body
string
required
Which action to run. One of
"payment_link" or "cancel" — any other value returns 400 Unsupported action, and so does an empty body.Supported actions
| Action | What it does |
|---|---|
payment_link | Returns the hosted invoice link again for an awaiting_payment request |
cancel | Cancels an awaiting_payment request so it no longer blocks a new purchase |
provisioning, active, failed, or canceled, these actions no longer apply.
Recover payment link
curl -X POST "https://app.tuco.ai/api/line-requests/6a092ebde4a7fbddc8a832da" \
-H "Authorization: Bearer tuco_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "action": "payment_link" }'
Success (200 OK)
{
"success": true,
"status": "awaiting_payment",
"paymentUrl": "https://invoice.stripe.com/...",
"invoiceId": "in_123",
"reused": true
}
payment_link can act like a safe recovery action:
- if payment is still needed, it gives you the invoice again
- if payment has already been reconciled, it can return the updated provisioning state instead
Cancel pending request
curl -X POST "https://app.tuco.ai/api/line-requests/6a092ebde4a7fbddc8a832da" \
-H "Authorization: Bearer tuco_xxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "action": "cancel" }'
Success (200 OK)
{
"success": true,
"status": "canceled",
"line": {
"_id": "6a092ebde4a7fbddc8a832da",
"provisioningStatus": "canceled",
"paymentStatus": "failed"
}
}
Error responses
| Status | When | Body |
|---|---|---|
400 | Invalid line request id or unsupported action | { "error": "Invalid line request id" } or { "error": "Unsupported action" } |
401 | Missing or invalid API key / session | { "error": "Unauthorized" } |
403 | payment_link used without an active subscription | { "success": false, "status": "subscription_required", "message": "...", "redirect": "/billing" } |
404 | Request not found in your workspace | { "error": "Line request not found" } |
409 | Action does not apply to the current request state | { "success": false, "status": "...", "message": "..." } |