This guide intends on teaching you all about the file galaxy API and how to use it to upload files through the API!


API options

We have the option to upload,geturl, pastebin, info, base64 as the options to run. Please see below for the ways to use them


upload.php

URL https://filegalaxy.xyz/api/upload.php
Method: POST file
Post var name: file
Answer type: JSON

If the upload was successful answer will look like this:

{
    "status":"ok",
    "hash":"y1b6hr.jpg",
    "url":"https://filegalaxy.xyz/y1b6hr.jpg"
}


If there is an error the server will answer with status:err and a reason, like:

{
    "status":"err",
    "reason":"Unsupported filetype"
}


Examples

Uploading a file called test.jpg via curl

curl -s -F "[email protected].jpg" https://filegalaxy.xyz/api/upload.php


Answer from the server:
{"status":"ok","hash":"y1b6hr.jpg","url":"https://filegalaxy.xyz/y1b6hr.jpg"}


Uploading from the commandline using alias, requires jq package for json response decoding

Put this in your .bashrc or .zshrc:
pict () {
    curl -s -F "[email protected]${1:--}" https://filegalaxy.xyz/api/upload.php | jq -r '.url';
}


Usage:
$ cat path/to/image.jpg | pict


Repsonse:
https://filegalaxy.xyz/y1b6hr.jpg



geturl.php

URL https://filegalaxy.xyz/api/geturl.php
Method: GET
Var name: url
Answer type: JSON

Upload content by providing a link to the content. If the link points to a website, the HTML of the page is uploaded as a text bin.

{
    "status":"ok",
    "hash":"y1b6hr.jpg",
    "url":"https://filegalaxy.xyz/y1b6hr.jpg",
    "delete_code": "aqxqlv3kqokxd15xpkqp8zjljpqerveu",
    "delete_url":   "https://filegalaxy.xyz/delete_aqxqlv3kqokxd15xpkqp8zjljpqerveu/2mr2va.txt"
}


If there is an error the server will answer with status:err and a reason:

{
    "status":"err",
    "reason":"Unsupported filetype"
}


Examples

Uploading the HTML of xkcd.com

curl -s https://filegalaxy.xyz/api/geturl.php?url=https://xkcd.com


Answer from the server:
{
  "status": "ok",
  "hash": "2mr2va.txt",
  "url": "https://filegalaxy.xyz/2mr2va.txt",
  "filetype": "text",
  "delete_code": "aqxqlv3kqokxd15xpkqp8zjljpqerveu",
  "delete_url": "https://filegalaxy.xyz/delete_aqxqlv3kqokxd15xpkqp8zjljpqerveu/2mr2va.txt"
}


Uploading a Video from Imgur

curl https://filegalaxy.xyz/api/geturl.php?url=https://i.imgur.com/qQstLQt.mp4


Answer from the server:

{
  "status": "ok",
  "hash": "u0ni1m.mp4",
  "url": "https://filegalaxy.xyz/u0ni1m.mp4",
  "filetype": "mp4",
  "delete_code": "aqxqlv3kqokxd15xpkqp8zjljpqerveu",
  "delete_url": "https://filegalaxy.xyz/delete_aqxqlv3kqokxd15xpkqp8zjljpqerveu/u0ni1m.mp4"
}


Uploading from the commandline using alias, requires jq package for json response decoding

Put this in your .bashrc or .zshrc:
pictget () {
    curl -s "hhttps://filegalaxy.xyz/api/geturl.php?url=$1" | jq -r '.url';
}


Usage:
$ pictget https://i.imgur.com/qQstLQt.mp4


Repsonse:
https://filegalaxy.xyz/u0ni1m.mp4



pasetebin.php

URL https://filegalaxy.xyz/api/paste.php
Method: GET/POST text
Post var name: paste
Answer: Plaintext URL to pasted bin

This API can be used to directly post text. Server responds with the URL to the bin or with an error message

Example

Creating a new text bin that ready "Hello World"

curl -F "paste=Hello World" https://filegalaxy.xyz/api/paste.php


Answer from the server:
https://filegalaxy.xyz/vekjy4e5rr.txt



info.php

URL https://filegalaxy.xyz/api/info.php
Method: POST/GET text
Query var name: code
Answer: JSON

This API will get information about any given hash.

Example

curl https://filegalaxy.xyz/api/info.php?code=9k3rbw.mp4


Answer from the server:

{
  "status": "ok",
  "hash": "9k3rbw.mp4",
  "size_bytes": 2513225,
  "size_interpreted": "2.4 MB",
  "type": "video/mp4",
  "type_interpreted": "mp4"
}



base64.php

URL https://filegalaxy.xyz/api/base64.php
Method: POST/GET
Query var name: base64
Answer: JSON

Example

Upload local image "test.jpg" to File Galaxy

(echo -n "base64="; echo -n "data:image/jpeg;base64,$(base64 -w 0 test.jpg)") | curl --data @- https://filegalaxy.xyz/api/base64.php


{
  "status": "ok",
  "hash": "lpl119.jpg",
  "url": "https://dev.filegalaxy.xyz/lpl119.jpg",
  "filetype": "jpeg",
  "delete_code": "z0e1mdo8szxnauspxp2f080e4wd4ycf2",
  "delete_url": "https://dev.filegalaxy.xyz/delete_z0e1mdo8szxnauspxp2f080e4wd4ycf2/lpl119.jpg"
}
Was this article helpful?
Cancel
Thank you!