Skip to content
Aller au contenu
Charitips

API reference · Sites

Create a site

POST/v1/sites

Add a subdomain or a custom domain for your campaigns.

Requires a Bearer access token.

Body

CreateSiteDto
  • subdomain#string

    Subdomain to register. Required if customDomain not provided.

    Required in the spec, optional for the API.

  • customDomain#string

    Custom domain to register. Required if subdomain not provided.

    Required in the spec, optional for the API.

  • accountId#stringUUID

    Only required to link the created entity to a child account instead of the current one.

Response

201 · Site

No field is described in the spec.

  • siteId#stringalways returned

  • subdomain#string

  • customDomain#string

  • accountId#stringalways returned

  • createdAt#string (date-time)always returned

  • updatedAt#string (date-time)always returned

Errors

  • 400At least one of subdomain and customDomain is required.
    {
      "statusCode": 400,
      "message": "At least one of subdomain and customDomain is required.",
      "error": "Bad Request"
    }
  • 400Invalid customDomain
    {
      "statusCode": 400,
      "message": "Invalid customDomain",
      "error": "Bad Request"
    }
  • 400A field is missing, has the wrong type, or is not part of the request schema.

    Every request with a body or query is validated.

    {
      "statusCode": 400,
      "message": [
        "amount must not be less than 1",
        "property foo should not exist"
      ],
      "error": "Bad Request"
    }
  • 401Unauthorized

    Missing, expired or invalid access token.

    {
      "statusCode": 401,
      "message": "Unauthorized"
    }
  • 402Plan upgrade required
    {
      "statusCode": 402,
      "message": "Plan upgrade required"
    }
  • 403New subdomain site can't be created
    {
      "statusCode": 403,
      "message": "New subdomain site can't be created",
      "error": "Forbidden"
    }
  • 403Account not validated
    {
      "statusCode": 403,
      "message": "Account not validated",
      "error": "Forbidden"
    }
  • 403Account closed
    {
      "message": "Account closed",
      "code": "ACCOUNT_CLOSED"
    }
POST /v1/sites
curl -X POST https://api.sandbox.charitips.com/v1/sites \  -H "Authorization: Bearer $CHARITIPS_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "subdomain": "donations"  }'
Built from the spec and the API code

Request bodies are written for this docs and checked against the API's validation; ids in angle brackets are placeholders. Response values are placeholders built from the schema.