Domains

The Domains API allows you to manage your domains and redirect users to the right place when they access your domain.

The object

The domain object has the following attributes:

  • Name
    id
    Type
    uuid
    Description

    The unique domain id.

  • Name
    workspace_id
    Type
    uuid
    Description

    The workspace id where the domain is associated.

  • Name
    domain
    Type
    string
    Description

    The domain tld, like go.mercantive.com.

  • Name
    status
    Type
    eum
    Description

    The domain dns status, can be pending or active;

  • Name
    not_found_url
    Type
    string
    Description

    The url where user will be redirect when any link associated at this domain it's removed on where user access the root domain.

  • Name
    expired_url
    Type
    string
    Description

    The url where user will be redirect when any link associated at this domain expires.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the domain was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the domain was last updated.


GET/domains

List

This enpoint allows you to get a list paginated of all domains associated with your workspace.

  • Name
    page
    Type
    integer
    Description

    The pagination page number.

Request

GET
/domains
curl -X GET https://lua.sh/api/v1/domains \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d page=1

Response

{
  "data": [
    {
      "id": "9d5f620d-9b7a-4c25-9e75-3c0615c5e13c",
      "workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
      "domain": "go.mercantive.com",
      "status": "active",
      "not_found_url": null,
      "expired_url": null,
      "created_at": "2024-10-30T23:12:05.000000Z",
      "updated_at": "2024-10-30T23:12:05.000000Z"
    },
    {
      "id": "8c6f620d-9b7a-4c25-9e75-3c0615c5e12f",
      "workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
      "domain": "go.changelogfy.com",
      "status": "active",
      "not_found_url": null,
      "expired_url": null,
      "created_at": "2024-10-30T23:12:05.000000Z",
      "updated_at": "2024-10-30T23:12:05.000000Z"
    },
  ],
  "links": {
    "first": "https://lua.sh/api/v1/domains?page=1",
    "last": "https://lua.sh/api/v1/domains?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "Previous",
        "active": false
      },
      {
        "url": "https://lua.sh/api/v1/domains?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next",
        "active": false
      }
    ],
    "path": "https://lua.sh/api/v1/domains",
    "per_page": 25,
    "to": 2,
    "total": 2
  }
}

POST/domains

Create

This endpoint allows you to create a new domain associated with your workspace.

Attributes

  • Name
    domain
    Type
    string
    Required
    *
    Description

    The domain tld that you want add to your workspace, like go.mercantive.com.

  • Name
    not_found_url
    Type
    string
    Description

    The url where user will be redirect when any link associated at this domain it's removed on where user access the root domain. e.g. https://mercantive.com.

  • Name
    expired_url
    Type
    string
    Description

    The url where user will be redirect when any link associated at this domain expires. e.g. https://mercantive.com.

Request

POST
/domains
curl -X POST https://lua.sh/api/v1/domains \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d domain="go.mercantive.com" \
  -d not_found_url="https://mercantive.com" \
  -d expired_url="https://mercantive.com"

Response

{
  "id": "9d855dec-36d8-47bd-9837-1d0d9fd23332",
  "workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
  "domain": "go.mercantive.com",
  "status": "pending",
  "not_found_url": null,
  "expired_url": null,
  "created_at": "2024-11-18T20:21:59.000000Z",
  "updated_at": "2024-11-18T20:21:59.000000Z"
}

PUT/domains/{id}

Update

This endpoint enables you to update a domain associated with your workspace.

Attributes

  • Name
    id
    Type
    uuid
    Required
    *
    Description

    The domain id.

  • Name
    domain
    Type
    string
    Required
    *
    Description

    The domain tld, like go.mercantive.com.

  • Name
    not_found_url
    Type
    string
    Description

    The url where user will be redirect when any link associated at this domain it's removed on where user access the root domain. e.g. https://mercantive.com.

  • Name
    expired_url
    Type
    string
    Description

    The url where user will be redirect when any link associated at this domain expires. e.g. https://mercantive.com.

Request

PUT
/domains/{id}
curl -X PUT https://lua.sh/api/v1/domains/{id} \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d domain="go.mercantive.com"

Response

{
  "id": "9d855dec-36d8-47bd-9837-1d0d9fd23332",
  "workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
  "domain": "go.mercantive.com",
  "status": "active",
  "not_found_url": null,
  "expired_url": null,
  "created_at": "2024-11-18T20:21:59.000000Z",
  "updated_at": "2024-11-18T20:21:59.000000Z"
}

DELETE/domains/{id}

Delete

This endpoint allows you to delete a domain associated with your workspace.

Attributes

  • Name
    id
    Type
    uuid
    Required
    *
    Description

    The domain id.

Request

DELETE
/domains/{id}
curl -X DELETE https://lua.sh/api/v1/domains/{id} \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json"

Response

{
  "message": "Domain deleted"
}