> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bsy.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Bitsy Link

> Create a new Bitsy Link



## OpenAPI

````yaml POST /link/create
openapi: 3.0.1
info:
  title: OpenAPI BitsyLink Store
  description: >-
    A sample API that uses a BitsyLink store as an example to demonstrate
    features in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.bsy.sh/v1
security:
  - bearerAuth: []
paths:
  /link/create:
    post:
      description: Create a new Bitsy Link
      requestBody:
        description: Create a new Bitsy Link
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBitsyLink'
        required: true
      responses:
        '201':
          description: Bitsy Link success response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBitsyLinkSuccess'
        '400':
          description: Default Client Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DefaultClientError'
        '401':
          description: Authorization Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthorizationError'
        '403':
          description: Permission Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermissionError'
        '422':
          description: Request Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DefaultServerError'
components:
  schemas:
    CreateBitsyLink:
      allOf:
        - required:
            - long_url
          type: object
          properties:
            domain:
              type: string
              format: uuid
              description: The UUID of the domain where the link will be created.
            long_url:
              type: string
              format: uri
              description: The long URL that the shortened link will redirect to.
        - $ref: '#/components/schemas/BitsyLink'
    CreateBitsyLinkSuccess:
      required:
        - status
        - data
      type: object
      properties:
        status:
          type: string
          enum:
            - success
          description: Indicates the status of the request.
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: The unique identifier for the created link.
            title:
              type: string
              description: The title of the link.
            long_url:
              type: string
              format: uri
              description: The original long URL that the shortened link points to.
            bitsy_url:
              type: string
              description: The shortened URL generated for the link.
            custom_url:
              type: string
              description: A custom URL if provided; otherwise, null.
            created_at:
              type: string
              format: date-time
              description: The timestamp when the link was created.
    DefaultClientError:
      required:
        - status
        - message
      type: object
      properties:
        status:
          type: string
          enum:
            - failure
          description: Indicates the status of the error.
        message:
          type: string
          description: A message providing additional details about the default error.
    AuthorizationError:
      required:
        - status
        - message
      type: object
      properties:
        status:
          type: string
          enum:
            - failure
          description: Indicates the status of the authorization.
        message:
          type: string
          description: >-
            A message providing additional details about the authorization
            error.
    PermissionError:
      required:
        - status
        - message
      type: object
      properties:
        status:
          type: string
          enum:
            - failure
          description: Indicates the status of the authorization.
        message:
          type: string
          description: >-
            A message providing additional details about the authorization
            error.
    ValidationError:
      required:
        - status
        - message
        - errors
      type: object
      properties:
        status:
          type: string
          enum:
            - failure
          description: Indicates the status of the validation.
        message:
          type: string
          description: A message providing additional details about the validation error.
        errors:
          type: object
          properties:
            formErrors:
              type: array
              items:
                type: string
              description: List of form-level errors.
            fieldErrors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
              description: >-
                Object containing field-specific errors, where keys are field
                names and values are arrays of error messages.
          description: Detailed error information regarding validation failures.
    DefaultServerError:
      required:
        - status
        - message
      type: object
      properties:
        status:
          type: string
          enum:
            - error
          description: Indicates the status of the error.
        message:
          type: string
          description: A message providing additional details about the default error.
    BitsyLink:
      type: object
      properties:
        favicon:
          type: string
          description: URL of the favicon for the link.
        title:
          type: string
          maxLength: 150
          description: Title of the link, up to 150 characters.
        custom_link:
          type: string
          minLength: 3
          maxLength: 50
          description: Custom slug for the link, between 3 and 50 characters.
        tags:
          type: array
          items:
            type: string
            minLength: 1
          description: Array of tags associated with the link.
        has_utm:
          type: boolean
          description: Indicates if UTM parameters are used.
        utm_source:
          type: string
          maxLength: 200
          description: UTM source for tracking.
        utm_medium:
          type: string
          maxLength: 200
          description: UTM medium for tracking.
        utm_campaign:
          type: string
          maxLength: 200
          description: UTM campaign for tracking.
        utm_term:
          type: string
          maxLength: 200
          description: UTM term for paid search.
        utm_content:
          type: string
          maxLength: 200
          description: UTM content for differentiating ads.
        has_opengraph:
          type: boolean
          description: Indicates if OpenGraph metadata is included.
        meta_title:
          type: string
          maxLength: 150
          description: Meta title for the link, up to 150 characters.
        meta_description:
          type: string
          maxLength: 250
          description: Meta description for the link, up to 250 characters.
        meta_image:
          type: string
          description: URL of the image to use for the link's metadata.
        has_android_targeting:
          type: boolean
          description: Indicates if there is a target URL for Android.
        android_target_url:
          type: string
          description: Target URL for Android devices.
        has_ios_targeting:
          type: boolean
          description: Indicates if there is a target URL for iOS.
        ios_target_url:
          type: string
          description: Target URL for iOS devices.
        has_windows_targeting:
          type: boolean
          description: Indicates if there is a target URL for Windows.
        windows_target_url:
          type: string
          description: Target URL for Windows devices.
        has_linux_targeting:
          type: boolean
          description: Indicates if there is a target URL for Linux.
        linux_target_url:
          type: string
          description: Target URL for Linux devices.
        has_geo_targeting:
          type: boolean
          description: Indicates if geo-targeting is used.
        geo_targets:
          type: array
          items:
            type: object
            properties:
              country_id:
                type: string
                description: Two-letter country code (ISO 3166-1 alpha-2).
                enum:
                  - AD
                  - AE
                  - AF
                  - AG
                  - AI
                  - AL
                  - AM
                  - AO
                  - AR
                  - AS
                  - AT
                  - AU
                  - AW
                  - AX
                  - AZ
                  - BA
                  - BB
                  - BD
                  - BE
                  - BF
                  - BG
                  - BH
                  - BI
                  - BJ
                  - BL
                  - BM
                  - BN
                  - BO
                  - BQ
                  - BR
                  - BS
                  - BT
                  - BV
                  - BW
                  - BY
                  - BZ
                  - CA
                  - CC
                  - CD
                  - CF
                  - CG
                  - CH
                  - CI
                  - CK
                  - CL
                  - CM
                  - CN
                  - CO
                  - CR
                  - CU
                  - CV
                  - CW
                  - CX
                  - CY
                  - CZ
                  - DE
                  - DJ
                  - DK
                  - DM
                  - DO
                  - DZ
                  - EC
                  - EE
                  - EG
                  - EH
                  - ER
                  - ES
                  - ET
                  - FI
                  - FJ
                  - FM
                  - FO
                  - FR
                  - GA
                  - GB
                  - GD
                  - GE
                  - GF
                  - GG
                  - GH
                  - GI
                  - GL
                  - GM
                  - GN
                  - GP
                  - GQ
                  - GR
                  - GT
                  - GU
                  - GW
                  - GY
                  - HK
                  - HM
                  - HN
                  - HR
                  - HT
                  - HU
                  - ID
                  - IE
                  - IL
                  - IM
                  - IN
                  - IO
                  - IQ
                  - IR
                  - IS
                  - IT
                  - JE
                  - JM
                  - JO
                  - JP
                  - KE
                  - KG
                  - KH
                  - KI
                  - KM
                  - KN
                  - KP
                  - KR
                  - KW
                  - KY
                  - KZ
                  - LA
                  - LB
                  - LC
                  - LI
                  - LK
                  - LR
                  - LS
                  - LT
                  - LU
                  - LV
                  - LY
                  - MA
                  - MC
                  - MD
                  - ME
                  - MF
                  - MG
                  - MH
                  - MK
                  - ML
                  - MM
                  - MN
                  - MO
                  - MP
                  - MQ
                  - MR
                  - MS
                  - MT
                  - MU
                  - MV
                  - MW
                  - MX
                  - MY
                  - MZ
                  - NA
                  - NC
                  - NE
                  - NF
                  - NG
                  - NI
                  - NL
                  - 'NO'
                  - NP
                  - NR
                  - NU
                  - NZ
                  - OM
                  - PA
                  - PE
                  - PF
                  - PG
                  - PH
                  - PK
                  - PL
                  - PM
                  - PN
                  - PR
                  - PT
                  - PW
                  - PY
                  - QA
                  - RE
                  - RO
                  - RS
                  - RU
                  - RW
                  - SA
                  - SB
                  - SC
                  - SD
                  - SE
                  - SG
                  - SH
                  - SI
                  - SJ
                  - SK
                  - SL
                  - SM
                  - SN
                  - SO
                  - SR
                  - SS
                  - ST
                  - SV
                  - SX
                  - SY
                  - SZ
                  - TC
                  - TD
                  - TF
                  - TG
                  - TH
                  - TJ
                  - TK
                  - TL
                  - TM
                  - TN
                  - TO
                  - TR
                  - TT
                  - TV
                  - TZ
                  - UA
                  - UG
                  - UM
                  - US
                  - UY
                  - UZ
                  - VA
                  - VC
                  - VE
                  - VG
                  - VI
                  - VN
                  - VU
                  - WF
                  - WS
                  - YE
                  - YT
                  - ZA
                  - ZM
                  - ZW
              target_url:
                type: string
                format: uri
                description: Target URL for the specified country.
            required:
              - country_id
              - target_url
          description: Array of geo-targeting rules.
        has_cloaking:
          type: boolean
          description: Indicates if cloaking is enabled.
        has_password:
          type: boolean
          description: Indicates if a password is required to access the link.
        password:
          type: string
          description: Password required to access the link.
        password_logo:
          type: string
          description: URL of the logo to display on the password prompt.
        has_expiration:
          type: boolean
          description: Indicates if the link has an expiration date or expiration clicks.
        expiration:
          type: string
          format: date-time
          description: Expiration date for the link in ISO 8601 format.
        expiration_clicks:
          type: string
          description: Maximum number of clicks before the link expires.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````