Get File By MD5
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.decart.ai/v1/files/by-md5/{md5}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.decart.ai/v1/files/by-md5/{md5}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.get("https://api.decart.ai/v1/files/by-md5/{md5}")
.header("x-api-key", "<api-key>")
.asString();val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.decart.ai/v1/files/by-md5/{md5}")
.get()
.addHeader("x-api-key", "<api-key>")
.build()
val response = client.newCall(request).execute()import Foundation
let url = URL(string: "https://api.decart.ai/v1/files/by-md5/{md5}")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["x-api-key": "<api-key>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))curl --request GET \
--url https://api.decart.ai/v1/files/by-md5/{md5} \
--header 'x-api-key: <api-key>'{
"id": "<string>",
"filename": "<string>",
"mime_type": "<string>",
"size_bytes": 123,
"md5": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}{
"detail": "File not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Files
Get File By MD5
Look up an uploaded file by the MD5 of its bytes, without knowing its file_* id. Returns the newest non-expired match when the same file was uploaded more than once. Compute the hash over the exact bytes you uploaded (for example md5sum image.png).
GET
/
v1
/
files
/
by-md5
/
{md5}
Get File By MD5
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.decart.ai/v1/files/by-md5/{md5}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.decart.ai/v1/files/by-md5/{md5}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.get("https://api.decart.ai/v1/files/by-md5/{md5}")
.header("x-api-key", "<api-key>")
.asString();val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.decart.ai/v1/files/by-md5/{md5}")
.get()
.addHeader("x-api-key", "<api-key>")
.build()
val response = client.newCall(request).execute()import Foundation
let url = URL(string: "https://api.decart.ai/v1/files/by-md5/{md5}")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["x-api-key": "<api-key>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))curl --request GET \
--url https://api.decart.ai/v1/files/by-md5/{md5} \
--header 'x-api-key: <api-key>'{
"id": "<string>",
"filename": "<string>",
"mime_type": "<string>",
"size_bytes": 123,
"md5": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}{
"detail": "File not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Headers
API key for authentication
Path Parameters
Hex MD5 of the uploaded bytes
Pattern:
^[0-9a-fA-F]{32}$Response
Successful Response
Was this page helpful?