Skip to content

PeakPrivacy Files API

Auth

HEADERS

KeyValue
Api-tokenapi_token from
[https://peakprivacy.ch/api-tokens](https://peakprivacy.ch/api-tokens)
X-Requested-WithXMLHttpRequest
Acceptapplication/json

401 - Unauthenticated; API Token is invalid or expired OR Subscription is inactive

json
{
    "error": "Unauthenticated"
}

POST Upload files

sh
https://api.peakprivacy.ch/v1/files

REQUEST BODY SCHEMA

KeyValue
files[]file
Multiple file uploader

Example request

Path for to file must be with @ when use are using curl for uploading files.

sh
curl --location --request POST 'https://api.peakprivacy.ch/v1/files' \
--header 'Api-token: api_token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json' \
-F "files[]=@/path/to/data1.json" \
-F "files[]=@/path/to/data2.json" \
-F "files[]=@/path/to/file3.json"

Possible Responses

200 - Success
json
[
    {
        "id": "ab4552c5-dc9e-4862-a50c-36809abe0ed9",
        "name": "data1.json",
        "ext": "json",
        "size": 568959,
        "mimetype": "application/json"
    },
    {
        "id": "09b8310a-90b9-4d1f-80e5-ab028a8d60c8",
        "name": "data3.json",
        "ext": "json",
        "size": 218671,
        "mimetype": "application/json"
    },
    {
        "id": "80185a61-8f84-4a56-8713-e7d0b157ecd4",
        "name": "data3.json",
        "ext": "json",
        "size": 118531,
        "mimetype": "application/json"
    }
]
400 - Bad Request; Validation Error
json
{
    "message": "Validation error",
    "errors": {
        "files.0": [
            "The data1.txt file must be with correct mimetype."
        ]
    }
}
401 - Unauthenticated; Form Token Expired
json
{
    "error": "Unauthenticated"
}
403 - Forbidden; Subscription amount limit has been reached
json
{
    "error": "Subscription amount limit has been reached"
}
413 - Forbidden;
json
{
    "error": "Request Entity Too Large"
}

GET List files

sh
https://api.peakprivacy.ch/v1/files

GET Parameters

KeyValue
limitint (optional)
default: 20
Per page files
cursorstring (optional)
Pagination cursor

Example request

sh
curl --location --request GET 'https://api.peakprivacy.ch/v1/files' \
--header 'Api-token: api_token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json'

Possible Responses

200 - Success
json
{
    "data": [
        {
            "id": "ab4552c5-dc9e-4862-a50c-36809abe0ed9",
            "name": "data1.json",
            "ext": "json",
            "size": 568959,
            "mimetype": "application/json"
        },
        {
            "id": "09b8310a-90b9-4d1f-80e5-ab028a8d60c8",
            "name": "data3.json",
            "ext": "json",
            "size": 218671,
            "mimetype": "application/json"
        },
        {
            "id": "80185a61-8f84-4a56-8713-e7d0b157ecd4",
            "name": "data3.json",
            "ext": "json",
            "size": 118531,
            "mimetype": "application/json"
        }
    ],
    "links": {
        "first": null,
        "last": null,
        "prev": "{{ $frontmatter.global.apiUrl }}/v1/files?cursor=eyJhaV9maWxlcy5pZCI6NjEsIl9wb2ludHNUb05leHRJdGVtcyI6ZmFsc2V9",
        "next": "{{ $frontmatter.global.apiUrl }}/v1/files?cursor=eyJhaV9maWxlcy5pZCI6NjMsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0"
    },
    "meta": {
        "path": "{{ $frontmatter.global.apiUrl }}/v1/files",
        "per_page": 3,
        "next_cursor": "eyJhaV9maWxlcy5pZCI6NjMsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
        "prev_cursor": "eyJhaV9maWxlcy5pZCI6NjEsIl9wb2ludHNUb05leHRJdGVtcyI6ZmFsc2V9"
    }
}
401 - Unauthenticated; Form Token Expired
json
{
    "error": "Unauthenticated"
}

GET Retrieve file

sh
https://api.peakprivacy.ch/v1/files/{id}

REQUEST PARAMETERS

KeyValue
idstring required

ID of the file to use.

Example request

sh
curl --location --request GET 'https://api.peakprivacy.ch/v1/files/{id}' \
--header 'Api-token: api_token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json'

Possible Responses

200 - Success
json
{
    "id": "ab4552c5-dc9e-4862-a50c-36809abe0ed9",
    "name": "data1.json",
    "ext": "json",
    "size": 568959,
    "mimetype": "application/json"
}
401 - Unauthenticated; Form Token Expired
json
{
    "error": "Unauthenticated"
}
404 - Not Found; File not found
json
{
    "error": "Not found"
}

DELETE Delete file

sh
https://api.peakprivacy.ch/v1/files/{id}

HEADERS

KeyValue
Api-tokenapi_token from
https://peakprivacy.ch/api-tokens
X-Requested-WithXMLHttpRequest
Acceptapplication/json

REQUEST PARAMETERS

KeyValue
idstring required

ID of the file to use.

Example request

sh
curl --location --request DELETE 'https://api.peakprivacy.ch/v1/files/{id}' \
--header 'Api-token: api_token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json'

Possible Responses

204 - Success
json
NO CONTENT
401 - Unauthenticated; Form Token Expired
json
{
    "error": "Unauthenticated"
}
404 - Not Found; File not found
json
{
    "error": "Not found"
}

Supported files

For text/ MIME types, the encoding must be one of utf-8, utf-16, or ascii.

FILE FORMATMIME TYPE
csvapplication/csv
text/csv
epubapplication/epub+zip
xlsapplication/vnd.ms-excel*
application/vnd.oasis.opendocument.spreadsheet
application/vnd.openxmlformats-officedocument.spreadsheetml.*
xlsxapplication/vnd.ms-excel*
application/vnd.oasis.opendocument.spreadsheet
application/vnd.openxmlformats-officedocument.spreadsheetml.*
htmtext/html
htmltext/html
mdtext/markdown
odtapplication/msword
application/vnd.ms-word*
application/vnd.oasis.opendocument.text
application/vnd.openxmlformats-officedocument.wordprocessingml.
application/vnd.ms-excel

application/vnd.oasis.opendocument.spreadsheet
application/vnd.openxmlformats-officedocument.spreadsheetml.
application/vnd.ms-powerpoint

application/vnd.oasis.opendocument.presentation
application/vnd.openxmlformats-officedocument.presentationml.*
pdfapplication/pdf
txttext/plain
texttext/plain
logtext/plain
pptapplication/vnd.ms-powerpoint*
application/vnd.oasis.opendocument.presentation
application/vnd.openxmlformats-officedocument.presentationml.*
pptxapplication/vnd.ms-powerpoint*
application/vnd.oasis.opendocument.presentation
application/vnd.openxmlformats-officedocument.presentationml.*
rsttext/x-rst
rtfapplication/rtf
text/rtf
tsvtext/tab-separated-values
docapplication/msword
application/vnd.ms-word*
application/vnd.oasis.opendocument.text
application/vnd.openxmlformats-officedocument.wordprocessingml.*
docxapplication/msword
application/vnd.ms-word*
application/vnd.oasis.opendocument.text
application/vnd.openxmlformats-officedocument.wordprocessingml.*
xmlapplication/xml
application/xhtml+xml
text/xml
pngimage/png
jpegimage/jpeg
jpgimage/jpeg
heicimage/heic
tiffimage/tiff
jp2image/jp2
gifimage/gif
webpimage/webp
bmpimage/bmp
pnmimage/x-portable-anymap