Discohook
  1. Share Links
Discohook
  • Discohook API
  • Reference
  • Discohook CDN
  • Using Discohook as an external message designer or previewer
  • Changelog
  • Share Links
    • Create Share Link
      POST
    • Get Share Link
      GET
  • Link Preview
    • Unfurl URL Embed
      GET
  • GitHub
    • Execute GitHub-Compatible Webhook in Forum Channel
      POST
  1. Share Links

Create Share Link

Production
https://discohook.app/api/v1
Production
https://discohook.app/api/v1
POST
https://discohook.app/api/v1
/share
CAUTION
If you are currently using share.discohook.app, migrate ASAP; it will stop being hosted soon!
Your request must be in total fewer than 24.5 MiB as indicated by the Content-Length header. This is a limitation of Cloudflare KV.

Request

Body Params application/json
data
object (QueryData) 
required
version
enum<string> 
optional
Allowed value:
d2
backup_id
string 
optional
messages
array[object (QueryDataMessage) {3}] 
required
targets
array[object (QueryDataTarget) {2}] 
required
ttl
integer <int32>
optional
Total number of seconds that the share link should be valid for, relative to now. e.x. 300 creates a share link that expires in 5 minutes.
>= 300<= 2419200
Default:
604800
Example
{
    "data": {
        "version": "d2",
        "backup_id": "string",
        "messages": [
            {
                "_id": "string",
                "data": {
                    "username": "string",
                    "avatar_url": "string",
                    "author": {
                        "name": "string",
                        "icon_url": "string",
                        "badge": "string"
                    },
                    "content": "string",
                    "embeds": [
                        {
                            "title": "string",
                            "description": "string",
                            "color": 0,
                            "author": {
                                "name": "string",
                                "url": "string",
                                "icon_url": "string"
                            },
                            "fields": [
                                {
                                    "name": "string",
                                    "value": "string",
                                    "inline": true
                                }
                            ],
                            "footer": {
                                "text": "string",
                                "icon_url": "string"
                            },
                            "timestamp": "2019-08-24T14:15:22Z",
                            "image": {
                                "url": "string"
                            },
                            "thumbnail": {
                                "url": "string"
                            },
                            "provider": {
                                "name": "string",
                                "url": "string"
                            }
                        }
                    ],
                    "attachments": [
                        "string"
                    ],
                    "webhook_id": "string",
                    "components": [
                        {
                            "type": 1,
                            "components": [
                                {
                                    "style": "1",
                                    "custom_id": "string"
                                }
                            ]
                        }
                    ],
                    "flags": 0
                },
                "reference": "string"
            }
        ],
        "targets": [
            {
                "type": 1,
                "url": "http://example.com"
            }
        ]
    },
    "ttl": 604800
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://discohook.app/api/v1/share' \
--header 'Content-Type: application/json' \
--data-raw '{
    "data": {
        "version": "d2",
        "backup_id": "string",
        "messages": [
            {
                "_id": "string",
                "data": {
                    "username": "string",
                    "avatar_url": "string",
                    "author": {
                        "name": "string",
                        "icon_url": "string",
                        "badge": "string"
                    },
                    "content": "string",
                    "embeds": [
                        {
                            "title": "string",
                            "description": "string",
                            "color": 0,
                            "author": {
                                "name": "string",
                                "url": "string",
                                "icon_url": "string"
                            },
                            "fields": [
                                {
                                    "name": "string",
                                    "value": "string",
                                    "inline": true
                                }
                            ],
                            "footer": {
                                "text": "string",
                                "icon_url": "string"
                            },
                            "timestamp": "2019-08-24T14:15:22Z",
                            "image": {
                                "url": "string"
                            },
                            "thumbnail": {
                                "url": "string"
                            },
                            "provider": {
                                "name": "string",
                                "url": "string"
                            }
                        }
                    ],
                    "attachments": [
                        "string"
                    ],
                    "webhook_id": "string",
                    "components": [
                        {
                            "type": 1,
                            "components": [
                                {
                                    "style": "1",
                                    "custom_id": "string"
                                }
                            ]
                        }
                    ],
                    "flags": 0
                },
                "reference": "string"
            }
        ],
        "targets": [
            {
                "type": 1,
                "url": "http://example.com"
            }
        ]
    },
    "ttl": 604800
}'

Responses

🟢200Success
application/json
Body
id
string 
required
url
string <uri>
required
Fully qualified URL, prefer using this over constructing your own
expires
string <date-time>
required
When the share link will expire if not refreshed. Don't rely on this value long-term for two reasons: 1) Deluxe members are able to refresh share links. 2) id is not guaranteed to never be used again, and so in the future may refer to different data
Example
{
    "id": "7pSFyueh",
    "url": "https://discohook.app/?share=7pSFyueh",
    "expires": "2024-05-29T14:38:53.519Z"
}
Modified at 2024-08-04 17:00:04
Previous
Changelog
Next
Get Share Link
Built with