Update Files

How do I update a file?

To update a file, make a POST request to the /files/[replace file id here]/update endpoint.

You can update the name (max characters: 150) and the publicly_available flag (true or false).

Example response:

		
{
	"success": true,
	"file": {
		"id": "hmxk",
		"created_at": 1690912689000,
		"file_size": 115577,
		"file_type": "pdf",
		"name": "new_file_name.pdf",
		"page_count": 2,
		"processed_state": "processed",
		"publicly_available": true
	}
}
		
		

Ruby code to delete a file:

			
require 'net/http'
require 'uri'

uri = URI.parse("https://api1.docalysis.com/api/v1/files/[file id]/update")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer your_api_key_here"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  'name' => 'new_file_name.pdf',
  'publicly_available': true,
})

req_options = {
  use_ssl: true,
}

response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(request)
end

puts response.body