Links
The link API allows you to create, update, and delete links, as well as retrieve QR codes for them.
The object
The link object has the following attributes:
- Name
id
- Type
- uuid
- Description
The link id.
- Name
workspace_id
- Type
- uuid
- Description
The workspace where link is associated.
- Name
domain
- Type
- string
- Description
The domain for the link, Example:
git.now
.
- Name
key
- Type
- string
- Description
The key for the link, Example:
paulocastellano
.
- Name
url
- Type
- string
- Description
The URL for the link, Example:
git.now/paulocastellano
.
- Name
link
- Type
- string
- Description
The full link, Example:
https://git.now/paulocastellano
.
- Name
utm_source
- Type
- string
- Description
The utm source for the link, Example:
facebook
.
- Name
utm_medium
- Type
- string
- Description
The utm medium for the link, Example:
social
.
- Name
utm_campaign
- Type
- string
- Description
The utm campaign for the link, Example:
black-friday
.
- Name
utm_term
- Type
- string
- Description
The utm term for the link, Example:
macbook-pro
.
- Name
utm_content
- Type
- string
- Description
The utm content for the link, Example:
creative-one
.
- Name
utm_name
- Type
- string
- Description
The utm name for the link, Example:
macbook-pro-creative-one
.
- Name
clicks
- Type
- integer
- Description
The number of clicks for the link.
- Name
last_click
- Type
- integer
- Description
The last click for the link.
- Name
external_id
- Type
- integer
- Description
The external_id for the link, it can be used to identify the link in an external system.
- Name
password
- Type
- integer
- Description
If the link is password protected, the encrypted password will be stored here.
- Name
created_at
- Type
- timestamp
- Description
Timestamp of when the link was created.
- Name
updated_at
- Type
- timestamp
- Description
Timestamp of when the link was last updated.
List
This enpoint allows you to get a list paginated of links associated with the workspace.
Request
curl -X GET https://lua.sh/api/v1/links \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response
{
"data": [
{
"id": "9d61376a-9069-4193-941a-cd783cfc147d",
"workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
"domain": "git.now",
"key": "paulocastellano",
"url": "https://github.com/paulocastellano",
"link": "https://git.now/paulocastellano",
"utm_source": null,
"utm_medium": null,
"utm_campaign": null,
"utm_term": null,
"utm_content": null,
"utm_name": null,
"clicks": 0,
"last_click": null,
"external_id": null,
"password": null,
"tags": [],
"created_at": "2024-10-31T21:04:31.000000Z",
"updated_at": "2024-10-31T21:04:31.000000Z"
}
],
"links": {
"first": "https://lua.sh/api/v1/links?page=1",
"last": "https://lua.sh/api/v1/links?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/links?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next",
"active": false
}
],
"path": "https://lua.sh/api/v1/links",
"per_page": 25,
"to": 1,
"total": 1
}
}
Create
This endpoint allows you to create a new link.
Attributes
- Name
key
- Type
- string
- Required
- *
- Description
The link key, Example:
paulocastellano
.
- Name
domain
- Type
- string
- Required
- *
- Description
The domain for the link, Example:
git.now
.
- Name
url
- Type
- string
- Required
- *
- Description
The URL for the link, Example:
https://github.com/paulocastellano
.
Request
curl -X POST https://lua.sh/api/v1/links \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d key="paulocastellano" \
-d domain="git.now" \
-d url="https://github.com/paulocastellano"
Response
{
"id": "9d8558af-997f-4a96-88dc-a515b6c1b567",
"workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
"domain": "git.now",
"key": "paulocastellano",
"url": "https://github.com/paulocastellano",
"link": "https://git.now/paulocastellano",
"utm_source": null,
"utm_medium": null,
"utm_campaign": null,
"utm_term": null,
"utm_content": null,
"utm_name": null,
"clicks": null,
"last_click": null,
"external_id": null,
"password": null,
"tags": [],
"created_at": "2024-11-18T20:07:21.000000Z",
"updated_at": "2024-11-18T20:07:21.000000Z"
}
Update
This endpoint enables you to update the details of a link.
Attributes
- Name
key
- Type
- string
- Required
- *
- Description
The link key, Example:
paulocastellano
.
- Name
domain
- Type
- string
- Required
- *
- Description
The domain for the link, Example:
git.now
.
- Name
url
- Type
- string
- Required
- *
- Description
The URL for the link, Example:
https://github.com/paulocastellano
.
Request
curl -X PUT https://lua.sh/api/v1/links/{id} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d key="paulocastellano" \
-d domain="git.now" \
-d url="https://github.com/paulocastellano"
Response
{
"id": "9d8558af-997f-4a96-88dc-a515b6c1b567",
"workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
"domain": "git.now",
"key": "paulocastellano",
"url": "https://github.com/paulocastellano",
"link": "https://git.now/paulocastellano",
"utm_source": null,
"utm_medium": null,
"utm_campaign": null,
"utm_term": null,
"utm_content": null,
"utm_name": null,
"clicks": 0,
"last_click": null,
"external_id": null,
"password": null,
"tags": [],
"created_at": "2024-11-18T20:07:21.000000Z",
"updated_at": "2024-11-18T20:11:23.000000Z"
}
Show
This endpoint enables you to retrieve the details of a link.
Attributes
- Name
id
- Type
- uuid
- Required
- *
- Description
The unique identifier for the link.
Request
curl -X GET https://lua.sh/api/v1/links/{id} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response
{
"id": "9d60cc1f-953a-4ade-8c80-aaa87835afb2",
"workspace_id": "9d5f3cf9-fa6f-498b-b5be-bd078b7d5339",
"domain": "git.now",
"key": "paulocastellano",
"url": "https://github.com/paulocastellano",
"link": "https://git.now/paulocastellano",
"utm_source": null,
"utm_medium": null,
"utm_campaign": null,
"utm_term": null,
"utm_content": null,
"utm_name": null,
"clicks": 0,
"last_click": null,
"external_id": null,
"password": null,
"tags": [],
"created_at": "2024-10-31T16:04:30.000000Z",
"updated_at": "2024-10-31T16:04:30.000000Z"
}
Qr code
This endpoint enables you to retrieve the QR code for a link.
Attributes
- Name
id
- Type
- uuid
- Required
- *
- Description
The link id.
- Name
download
- Type
- boolean
- Description
By default it's false, if you want to download the QR code pass
true
.
- Name
color
- Type
- string
- Description
You can pass a color to the QR code, Example:
#000000
.
Request
curl -X PUT https://lua.sh/api/v1/links/{id}/qr-code \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response
The response will be a PNG blob with the QR code.
Delete
This endpoint allows you to delete a link.
Attributes
- Name
id
- Type
- uuid
- Required
- *
- Description
The link id.
Request
curl -X DELETE https://lua.sh/api/v1/links/{id} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response
{
"message": "Link deleted"
}