> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.coperniq.io/api-reference/forms/attach-file-to-form-field-from-url/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.coperniq.io/_mcp/server. # Attach file to form field from URL POST https://api.coperniq.io/v1/forms/{form_id}/fields/file-from-url Content-Type: application/json Uploads a file from a public URL into Coperniq and attaches it to a specific FILE-type field on the form. Reference: https://docs.coperniq.io/api-reference/forms/attach-file-to-form-field-from-url ## Authentication - `x-api-key` header (required) — API Key authentication via header ## Request ### Path parameters - `form_id` (integer, required) — Form identifier ### Body (application/json) This endpoint expects an object. - `columnId` (integer, required) — ID of the FILE-type field to attach the uploaded file to. - `url` (string, required) — Public URL of the file to upload. - `name` (string, optional) — Optional display name for the uploaded file. - `projectId` (integer, optional) — Optional project ID to associate with the file. This will add the file to the project's 'Docs' section at the root level. - `action` (enum, optional) — Whether to append to existing files (add) or replace them entirely (replace). Defaults to add. - Allowed values: `add`, `replace` ## Response ### 200 File uploaded and attached successfully - `success` (boolean, optional) - `fileId` (integer, optional) - `formId` (integer, optional) - `columnId` (integer, optional) - `projectId` (integer, optional, nullable) - `action` (string, optional) ## Errors ### 400 Bad Request Error Invalid request - `message` (string, optional) - `code` (enum, optional) - Allowed values: `NOT_FOUND` - `field` (string, optional) — Field that caused the validation error (if applicable) ### 401 Unauthorized Error Authentication failed - `message` (string, optional) - `code` (enum, optional) - Allowed values: `NOT_FOUND` ### 404 Not Found Error Resource not found - `message` (string, optional) - `code` (enum, optional) - Allowed values: `NOT_FOUND` ## Examples **Request** ```json { "columnId": 1, "url": "string" } ``` **Response** ```json { "success": true, "fileId": 1, "formId": 1, "columnId": 1, "projectId": 1, "action": "string" } ``` **SDK Code** ```python import requests url = "https://api.coperniq.io/v1/forms/1/fields/file-from-url" payload = { "columnId": 1, "url": "string" } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.coperniq.io/v1/forms/1/fields/file-from-url'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"columnId":1,"url":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.coperniq.io/v1/forms/1/fields/file-from-url" payload := strings.NewReader("{\n \"columnId\": 1,\n \"url\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.coperniq.io/v1/forms/1/fields/file-from-url") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"columnId\": 1,\n \"url\": \"string\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.coperniq.io/v1/forms/1/fields/file-from-url") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"columnId\": 1,\n \"url\": \"string\"\n}") .asString(); ``` ```php request('POST', 'https://api.coperniq.io/v1/forms/1/fields/file-from-url', [ 'body' => '{ "columnId": 1, "url": "string" }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.coperniq.io/v1/forms/1/fields/file-from-url"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"columnId\": 1,\n \"url\": \"string\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "columnId": 1, "url": "string" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.coperniq.io/v1/forms/1/fields/file-from-url")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` > Official Coperniq API documentation. Build integrations for solar and construction project management — projects, opportunities, work orders, invoices, webhooks, and more.