Skip to content

Commit ce0559e

Browse files
committed
feat: public api
1 parent 8389bb8 commit ce0559e

File tree

8 files changed

+180
-32
lines changed

8 files changed

+180
-32
lines changed

next.config.mjs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import nextra from 'nextra';
1+
import nextra from "nextra";
22

33
const withNextra = nextra({
4-
theme: 'nextra-theme-docs',
5-
themeConfig: './theme.config.tsx',
4+
theme: "nextra-theme-docs",
5+
themeConfig: "./theme.config.tsx",
66
defaultShowCopyCode: true,
7-
})
7+
});
88

99
export default withNextra({
10-
env: {
11-
},
10+
env: {},
1211
async redirects() {
1312
return [
1413
{
1514
source: "/",
1615
destination: "/introduction",
1716
permanent: false,
1817
}
19-
]
20-
}
18+
];
19+
},
2120
});

package-lock.json

Lines changed: 7 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
},
2727
"devDependencies": {
2828
"@types/node": "^22.5.5",
29+
"@types/react": "19.0.1",
2930
"typescript": "5.6.2"
3031
}
3132
}

pages/_404/[...path].tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

pages/_meta.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
"public-api": "Public API",
23
"introduction": "Introduction",
34
"howitworks": "How it works",
45
"quickstart": "Quickstart",

pages/public-api.mdx

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
title: Public API
3+
description: "How to use Postiz public API"
4+
---
5+
6+
## Public API allows you to work with Postiz in headless mode
7+
8+
To use the Public API, go to Postiz settings and copy the API Key.<br />
9+
With each request you need to pass the API Key in the header `Authorization: {apiKey}`.<br />
10+
If you are using the hosted version of Postiz the URL will be `https://api.postiz.com/public/v1`.<br />
11+
If you are self-hosting Postiz the URL will be `https://{NEXT_PUBLIC_BACKEND_URL}/public/v1`.<br /><br />
12+
13+
<u>There is a limit of **30** requests per hours.</u>
14+
<br />
15+
Here are the following API endpoints you can use:
16+
17+
<br />
18+
19+
### Get all added integrations
20+
21+
```http
22+
GET https://api.postiz.com/public/v1/integrations
23+
```
24+
25+
Response:
26+
27+
```json
28+
[
29+
{
30+
"id": "asdfasf2342dsaxfcsf",
31+
"name": "Nevo David",
32+
"identifier": "facebook",
33+
"picture": "https://upload.postiz.com/picture.png",
34+
"disabled": false,
35+
"profile": "nevo_david",
36+
"customer": {
37+
"id": "asdfasf2342dsaxfcsfsadfsadf",
38+
"name": "My Customer"
39+
}
40+
}
41+
]
42+
```
43+
44+
---
45+
46+
<br />
47+
48+
### Upload a new file (from-data)
49+
50+
```http
51+
POST https://api.postiz.com/public/v1/upload
52+
```
53+
54+
Payload:
55+
`file` - File
56+
57+
Response:
58+
59+
```json
60+
{
61+
"id": "e639003b-f727-4a1e-87bd-74a2c48ae41e",
62+
"name": "vXJYn8EzSB.png",
63+
"path": "https://uploads.gitroom.com/vXJYn8EzSB.png",
64+
"organizationId": "85460a39-6329-4cf4-a252-187ce89a3480",
65+
"createdAt": "2024-12-14T08:18:54.274Z",
66+
"updatedAt": "2024-12-14T08:18:54.274Z"
67+
}
68+
```
69+
70+
---
71+
72+
<br />
73+
### Post list
74+
75+
```http
76+
GET https://api.postiz.com/public/v1/posts
77+
```
78+
79+
Query:
80+
| Name | Type | Value |
81+
| --- | --- | --- |
82+
| display | string | day \| week \| month |
83+
| day | number | 0-6 |
84+
| week | number | 1-52 |
85+
| month | number | 1-12 |
86+
| year | number | 2022+ |
87+
88+
** day is required if display is day<br />
89+
** week is required if display is week or day<br />
90+
** month is required if display is month or week<br />
91+
** year is required<br /><br />
92+
93+
Response:
94+
95+
```json
96+
{
97+
"posts": [
98+
{
99+
"id": "cm4gklk8o00008copo77fa0f8",
100+
"content": "blabla",
101+
"publishDate": "2024-12-09T05:06:00.000Z",
102+
"releaseURL": "https://twitter.com/nevodavid/status/1865986385708204316",
103+
"state": "QUEUE|PUBLISHED|ERROR|DRAFT",
104+
"integration": {
105+
"id": "cm4ean69r0003w8w1cdomox9n",
106+
"providerIdentifier": "x",
107+
"name": "Nevo David",
108+
"picture": "https://uploads.gitroom.com/5g9mEIVCAq.jpeg"
109+
}
110+
}
111+
]
112+
}
113+
```
114+
115+
---
116+
117+
<br />
118+
### Create / update a post
119+
120+
```http
121+
POST https://api.postiz.com/public/v1/posts
122+
```
123+
124+
Payload:
125+
126+
```json
127+
{
128+
"type": "draft|schedule|now",
129+
"date": "2024-12-14T08:18:54.274Z",
130+
"posts": [
131+
{
132+
"integration": {
133+
"id": "asdfsad23rwdfasfsddc"
134+
},
135+
"value": [
136+
{
137+
"content": "This is my cool post",
138+
"id": "Only if you want to edit and existing post",
139+
"image": [
140+
{
141+
"id": "string"
142+
}
143+
]
144+
}
145+
],
146+
"group": "uniqueId for all the posts in the same group",
147+
"settings": {
148+
"[key]": "check each integration DTOs in the files, or wait for the error on a new request"
149+
}
150+
}
151+
]
152+
}
153+
```
154+
155+
Response:
156+
157+
```json
158+
{
159+
"id": "e639003b-f727-4a1e-87bd-74a2c48ae41e"
160+
}
161+
```

pages/quickstart.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: 'Quickstart'
33
slug: '/quickstart'
4+
order: 1
45
---
56

67
## Self Hosted installation options

pages/reverse-proxies/_meta.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export default {
2+
};

0 commit comments

Comments
 (0)