Skip to content

Commit 431a760

Browse files
Merge pull request #641 from plausible/custom-props-sites-api
Add custom props to Sites API documentation
2 parents 9151d10 + 97abf10 commit 431a760

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

docs/sites-api.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ The Plausible Site provisioning API offers a way to create and manage sites in y
1616
* List existing goals
1717
* Find or create a goal by type and value (learn more about [goals and custom events](goal-conversions.md))
1818
* Delete an existing goal
19+
* List existing custom properties
20+
* Create a custom property
21+
* Delete an existing custom property
1922
* List site guests/invitations
2023
* Create site guest invitations
2124
* Delete site guests/invitations
@@ -418,6 +421,94 @@ Id of your site in Plausible.
418421

419422
<hr / >
420423

424+
### GET /api/v1/sites/custom-props
425+
426+
Gets a list of existing custom properties for a given `site_id` (use the site domain as the ID).
427+
428+
```bash title="Try it yourself"
429+
curl -X GET https://plausible.io/api/v1/sites/custom-props?site_id=test-domain.com \
430+
-H "Authorization: Bearer ${TOKEN}"
431+
```
432+
433+
```json title="Response 200 OK"
434+
{
435+
"custom_properties": [
436+
{
437+
"property": "author"
438+
},
439+
{
440+
"property": "title"
441+
}
442+
]
443+
}
444+
```
445+
446+
#### Query parameters
447+
<hr / >
448+
449+
**site_id** <Required />
450+
451+
Id of your site in Plausible.
452+
453+
<hr / >
454+
455+
### PUT /api/v1/sites/custom-props
456+
457+
Creates a custom property for a given `site_id` (use the site domain as the ID). This endpoint is idempotent, it won't fail if a custom property with the provided name already exists.
458+
459+
```bash title="Try it yourself"
460+
curl -X PUT https://plausible.io/api/v1/sites/custom-props \
461+
-H "Authorization: Bearer ${TOKEN}" \
462+
-F 'site_id="test-domain.com"' \
463+
-F 'property="title"'
464+
```
465+
466+
```json title="Response 200 OK"
467+
{
468+
"created": true
469+
}
470+
```
471+
472+
#### Body parameters
473+
<hr / >
474+
475+
**site_id** <Required />
476+
477+
Id of your site in Plausible.
478+
479+
<hr / >
480+
481+
**property** <Required />
482+
483+
Name of the custom property
484+
485+
<hr / >
486+
487+
### DELETE /api/v1/sites/custom-props/:property
488+
489+
Deletes a custom property from your Plausible account. The API key must belong to the owner of the site. The site must owned by the current user.
490+
491+
```bash title="Try it yourself"
492+
curl -X DELETE https://plausible.io/api/v1/sites/custom-props/title \
493+
-H "Authorization: Bearer ${TOKEN}" \
494+
-F 'site_id="test-domain.com"'
495+
```
496+
497+
```json title="Response 200 OK"
498+
{
499+
"deleted": true
500+
}
501+
```
502+
503+
#### Body parameters
504+
<hr / >
505+
506+
**site_id** <Required />
507+
508+
Id of your site in Plausible.
509+
510+
<hr / >
511+
421512
### GET /api/v1/sites/guests
422513

423514
Gets a list of guests for a given `site_id` (use the site domain as the ID).

0 commit comments

Comments
 (0)