Base64
Converts an Image to Base64
POST /api/tools/image-to-base64
https://api.cookie-api.com/api/tools/image-to-base64
Authentication Learn how to get your API Key and use it in your requests!
{ "url": "URL from the Image that should be encode to Base64",}
curl --location 'http://api.cookie-api.com/api/tools/image-to-base64' \--header 'Authorization: API_Key' \--data '{ "url": "https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg"}'
import requests
url = 'http://api.cookie-api.com/api/tools/image-to-base64'headers = { 'Authorization': 'API_Key'}
data = { 'url': 'https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg'}
response = requests.post(url, headers=headers, json=data)print(response.json())
const fetch = require('node-fetch');
const url = 'http://api.cookie-api.com/api/tools/image-to-base64';const headers = { 'Authorization': 'API_Key'};
const data = { url: 'https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg'};
fetch(url, { method: 'POST', headers, body: JSON.stringify(data)}).then(res => res.json()).then(data => console.log(data)).catch(err => console.error(err));
package main
import ( "bytes" "encoding/json" "fmt" "log" "net/http")
func main() { url := "http://api.cookie-api.com/api/tools/image-to-base64" data := map[string]string{ "url": "https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg", } jsonData, err := json.Marshal(data) if err != nil { log.Fatal(err) }
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { log.Fatal(err) }
req.Header.Set("Authorization", "API_Key") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)}
const https = require('https');
const data = JSON.stringify({ url: 'https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg'});
const options = { hostname: 'api.cookie-api.com', path: '/api/tools/image-to-base64', method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }};
const req = https.request(options, res => { let responseData = ''; res.on('data', chunk => { responseData += chunk; }); res.on('end', () => { console.log(JSON.parse(responseData)); });});
req.on('error', error => { console.error(error);});
req.write(data);req.end();
require 'net/http'require 'json'require 'uri'
url = URI.parse('http://api.cookie-api.com/api/tools/image-to-base64')request = Net::HTTP::Post.new(url)request['Authorization'] = 'API_Key'request['Content-Type'] = 'application/json'request.body = { url: "https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg"}.to_json
response = Net::HTTP.start(url.hostname, url.port, use_ssl: true) do |http| http.request(request)end
puts JSON.parse(response.body)
use reqwest::blocking::Client;use reqwest::header::HeaderMap;use serde::{Deserialize, Serialize};
#[derive(Serialize)]struct ImageRequest { url: String,}
fn main() { let url = "http://api.cookie-api.com/api/tools/image-to-base64"; let client = Client::new(); let mut headers = HeaderMap::new(); headers.insert("Authorization", "API_Key".parse().unwrap());
let request_body = ImageRequest { url: "https://upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg".to_string(), };
let res = client .post(url) .headers(headers) .json(&request_body) .send() .unwrap();
println!("{}", res.text().unwrap());}
Responses
{ "base64": "string", "success": true}
Converted Images will be saved for 7 days. After that period, they will be cached and might no longer be accessible.
Convert Base64 to an Image
Converts Base64 to an Image
POST /api/tools/base64-to-image
https://api.cookie-api.com/api/tools/base64-to-image
Authentication Learn how to get your API Key and use it in your requests!
{ "base64": "Base64 that should be Converted to an Image",}
curl --location 'https://api.cookie-api.com/api/tools/base64-to-image' \--header 'Authorization: API_Key' \--data '{ "base64": "string"}'
import requests
url = 'https://api.cookie-api.com/api/tools/base64-to-image'headers = { 'Authorization': 'API_Key'}
data = { 'base64': 'string'}
response = requests.post(url, headers=headers, json=data)print(response.json())
const fetch = require('node-fetch');
const url = 'https://api.cookie-api.com/api/tools/base64-to-image';const headers = { 'Authorization': 'API_Key'};
const data = { base64: 'string'};
fetch(url, { method: 'POST', headers, body: JSON.stringify(data)}).then(res => res.json()).then(data => console.log(data)).catch(err => console.error(err));
package main
import ( "bytes" "encoding/json" "fmt" "log" "net/http")
func main() { url := "https://api.cookie-api.com/api/tools/base64-to-image" data := map[string]string{ "base64": "string", } jsonData, err := json.Marshal(data) if err != nil { log.Fatal(err) }
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { log.Fatal(err) }
req.Header.Set("Authorization", "API_Key") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)}
const https = require('https');
const data = JSON.stringify({ base64: 'string'});
const options = { hostname: 'api.cookie-api.com', path: '/api/tools/base64-to-image', method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }};
const req = https.request(options, res => { let responseData = ''; res.on('data', chunk => { responseData += chunk; }); res.on('end', () => { console.log(JSON.parse(responseData)); });});
req.on('error', error => { console.error(error);});
req.write(data);req.end();
require 'net/http'require 'json'require 'uri'
url = URI.parse('https://api.cookie-api.com/api/tools/base64-to-image')request = Net::HTTP::Post.new(url)request['Authorization'] = 'API_Key'request['Content-Type'] = 'application/json'request.body = { base64: "string"}.to_json
response = Net::HTTP.start(url.hostname, url.port, use_ssl: true) do |http| http.request(request)end
puts JSON.parse(response.body)
use reqwest::blocking::Client;use reqwest::header::HeaderMap;use serde::{Deserialize, Serialize};
#[derive(Serialize)]struct Base64Request { base64: String,}
fn main() { let url = "https://api.cookie-api.com/api/tools/base64-to-image"; let client = Client::new(); let mut headers = HeaderMap::new(); headers.insert("Authorization", "API_Key".parse().unwrap());
let request_body = Base64Request { base64: "string".to_string(), };
let res = client .post(url) .headers(headers) .json(&request_body) .send() .unwrap();
println!("{}", res.text().unwrap());}
Responses
{ "success": true, "url": "https://images.cookie-api.com/images/b9ca9929-4f14-4772-8eb7-cd513fa2ff1b.jpeg"}