Files
Associate File with Resource
Associate an existing file with a resource.
POST
/
v1
/
files
/
{file_id}
/
associations
Associate File with Resource
curl --request POST \
--url https://api.cuadra.ai/v1/files/{file_id}/associations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'resource_type=<string>' \
--data 'resource_id=<string>'import requests
url = "https://api.cuadra.ai/v1/files/{file_id}/associations"
payload = {
"resource_type": "<string>",
"resource_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({resource_type: '<string>', resource_id: '<string>'})
};
fetch('https://api.cuadra.ai/v1/files/{file_id}/associations', 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.cuadra.ai/v1/files/{file_id}/associations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "resource_type=%3Cstring%3E&resource_id=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://api.cuadra.ai/v1/files/{file_id}/associations"
payload := strings.NewReader("resource_type=%3Cstring%3E&resource_id=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cuadra.ai/v1/files/{file_id}/associations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("resource_type=%3Cstring%3E&resource_id=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cuadra.ai/v1/files/{file_id}/associations")
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/x-www-form-urlencoded'
request.body = "resource_type=%3Cstring%3E&resource_id=%3Cstring%3E"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
bearerAuthoauth2
JWT token from Stytch B2B authentication (magic link, SSO, or M2M)
Headers
Path Parameters
File ID
Example:
"file_abc123"
Body
application/x-www-form-urlencoded
Response
File associated successfully
The response is of type Response Associatefile · object.
Was this page helpful?
⌘I
Associate File with Resource
curl --request POST \
--url https://api.cuadra.ai/v1/files/{file_id}/associations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'resource_type=<string>' \
--data 'resource_id=<string>'import requests
url = "https://api.cuadra.ai/v1/files/{file_id}/associations"
payload = {
"resource_type": "<string>",
"resource_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({resource_type: '<string>', resource_id: '<string>'})
};
fetch('https://api.cuadra.ai/v1/files/{file_id}/associations', 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.cuadra.ai/v1/files/{file_id}/associations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "resource_type=%3Cstring%3E&resource_id=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://api.cuadra.ai/v1/files/{file_id}/associations"
payload := strings.NewReader("resource_type=%3Cstring%3E&resource_id=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cuadra.ai/v1/files/{file_id}/associations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("resource_type=%3Cstring%3E&resource_id=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cuadra.ai/v1/files/{file_id}/associations")
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/x-www-form-urlencoded'
request.body = "resource_type=%3Cstring%3E&resource_id=%3Cstring%3E"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}