Websites
The Public API exposes endpoints for managing the websites registered under an Organization. A website is identified by a name and a url.
Base configuration
Path note: The websites endpoints live under
/v1/organizations/...(without the/public-api/segment used by most other Public API resources). Confirm the host and base path with your integration target before sending requests.
| Environment | Base URL |
|---|---|
| Stage | https://staging-api.payments.ai/v1 |
| Production | https://api.payments.ai/v1 |
Authentication. All requests require a valid API key in the Authorization header. See Authentication.
Role required. The API key must belong to a user with the Editor role or higher. See Organizations for the role hierarchy.
Endpoints
Create a website
Registers a new website for the specified Organization.
- Method:
POST - Route:
/organizations/{organizationId}/websites
Body:
| Field | Type | Required | Constraints | Notes |
|---|---|---|---|---|
name | string | Yes | Max 22 chars | Name of the website. |
url | string | Yes | Max 50 chars, valid URL | The website URL (for example, https://myshop.com). |
Request:
curl -X POST \
"https://staging-api.payments.ai/v1/organizations/${ORGANIZATION_ID}/websites" \
-H 'Content-Type: application/json' \
-H "Authorization: ApiKey ${API_KEY}" \
-d '{
"name": "Summer Sale Store",
"url": "https://sale.myshop.com"
}'
Response (201):
{
"type": "object",
"data": {
"id": "6f326525-1586-479b-8176-55ba802caea4",
"organizationId": "46da78a6-034d-48d3-a28f-870d20b0ba00",
"name": "Summer Sale Store",
"url": "https://sale.myshop.com"
}
}
Retrieve a website
- Method:
GET - Route:
/organizations/{organizationId}/websites/{websiteId}
curl -X GET \
"https://staging-api.payments.ai/v1/organizations/${ORGANIZATION_ID}/websites/${WEBSITE_ID}" \
-H "Authorization: ApiKey ${API_KEY}"
No collection GET. The API spec does not expose a
GET /organizations/{organizationId}/websitescollection endpoint. Retrieve websites one at a time by ID.
Update a website
- Method:
PUT - Route:
/organizations/{organizationId}/websites/{websiteId}
Body: same shape as Create.
curl -X PUT \
"https://staging-api.payments.ai/v1/organizations/${ORGANIZATION_ID}/websites/${WEBSITE_ID}" \
-H 'Content-Type: application/json' \
-H "Authorization: ApiKey ${API_KEY}" \
-d '{
"name": "Winter Sale Store",
"url": "https://winter.myshop.com"
}'
Delete a website
- Method:
DELETE - Route:
/organizations/{organizationId}/websites/{websiteId}
curl -X DELETE \
"https://staging-api.payments.ai/v1/organizations/${ORGANIZATION_ID}/websites/${WEBSITE_ID}" \
-H "Authorization: ApiKey ${API_KEY}"
Deletes the website from the Organization.
Response example (200):
{
"success": true
}
The success boolean indicates whether the website was removed.
Response codes
| Status | Meaning |
|---|---|
| 200 | Request processed successfully. |
| 201 | Resource created. |
| 400 | Validation failed (for example, name exceeds 22 chars or url is invalid). The details field describes which field failed. |
| 401 | Missing or invalid API key. |
| 403 | The API key lacks the Editor role for this Organization. |
| 404 | Organization or website ID not found. |
| 500 | Internal server error. |
See Errors for the response shape.