Overview
SDKs
- Overview
- Server-side SDKs
- Client-side SDK
- Embedded Dashboards
APIs
- Links API
- Analytics API
- Conversions API
- Partners API
- Customers API
- Commissions API
- Folders API
- Tags API
- Domains API
Domains API
Create a domain
Create a domain for the authenticated workspace.
POST
/
domains
Copy
Ask AI
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Domains.Create(ctx, &operations.CreateDomainRequestBody{
Slug: "acme.com",
ExpiredURL: dubgo.String("https://acme.com/expired"),
NotFoundURL: dubgo.String("https://acme.com/not-found"),
Placeholder: dubgo.String("https://dub.co/help/article/what-is-dub"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Copy
Ask AI
{
"id": "<string>",
"slug": "acme.com",
"verified": false,
"primary": false,
"archived": false,
"placeholder": "https://dub.co/help/article/what-is-dub",
"expiredUrl": "https://acme.com/expired",
"notFoundUrl": "https://acme.com/not-found",
"assetLinks": null,
"appleAppSiteAssociation": null,
"logo": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"registeredDomain": {
"id": "<string>",
"createdAt": "<string>",
"expiresAt": "<string>"
}
}
Authorizations
Default authentication mechanism
Body
application/json
Response
201
application/json
The domain was created.
The response is of type object
.
Copy
Ask AI
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Domains.Create(ctx, &operations.CreateDomainRequestBody{
Slug: "acme.com",
ExpiredURL: dubgo.String("https://acme.com/expired"),
NotFoundURL: dubgo.String("https://acme.com/not-found"),
Placeholder: dubgo.String("https://dub.co/help/article/what-is-dub"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Copy
Ask AI
{
"id": "<string>",
"slug": "acme.com",
"verified": false,
"primary": false,
"archived": false,
"placeholder": "https://dub.co/help/article/what-is-dub",
"expiredUrl": "https://acme.com/expired",
"notFoundUrl": "https://acme.com/not-found",
"assetLinks": null,
"appleAppSiteAssociation": null,
"logo": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"registeredDomain": {
"id": "<string>",
"createdAt": "<string>",
"expiresAt": "<string>"
}
}
Assistant
Responses are generated using AI and may contain mistakes.