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

# Create login link

> Create a new data source login link

## OpenAPI

````json POST /ds/login/link
{
  "openapi": "3.0.3",
  "info": {
    "title": "Management API Reference",
    "version": "2.0.0",
    "description": "API Documentation for the Supermetrics Management API. For more information, visit https://supermetrics.com.",
    "termsOfService": "https://supermetrics.com/terms-of-service",
    "contact": {
      "name": "Supermetrics Suppot",
      "email": "support@supermetrics.com",
      "url": "https://supermetrics.com/support"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "x-api-id": "sm-management-api",
    "x-audience": "public"
  },
  "servers": [
    {
      "url": "https://api.supermetrics.com/v2",
      "description": "Global production public Supermetrics Management API base path.",
      "x-internal": "false"
    },
    {
      "url": "https://api.supermetrics.com",
      "description": "Global production public Supermetrics API base path (for Connector Builder and Team endpoints).",
      "x-internal": "false"
    }
  ],
  "tags": [
    {
      "name": "API Keys",
      "description": "Manage API keys to access Supermetrics API"
    },
    {
      "name": "Data Source Logins",
      "description": "Access your data source authentications"
    },
    {
      "name": "Data Source Login Links",
      "description": "Create single-use data source login links"
    },
    {
      "name": "Saved Queries",
      "description": "Manage queries saved in Query Manager"
    },
    {
      "name": "Table Groups",
      "description": "Manage your team's table groups"
    },
    {
      "name": "Team Lists",
      "description": "Manage centralized team lists for your queries"
    },
    {
      "name": "Team Settings",
      "description": "Configure general settings for your team"
    },
    {
      "name": "Data Transfers",
      "description": "Create, configure, and manage Data Warehouse transfers"
    },
    {
      "name": "Transfer Runs",
      "description": "Monitor execution history of Data Warehouse transfers"
    },
    {
      "name": "Data Backfills",
      "description": "Manage historical data backfills for your Data Warehouse transfers"
    },
    {
      "name": "Data Destinations",
      "description": "Create, configure, and manage Data Warehouse destinations"
    },
    {
      "name": "Data Source Connections",
      "description": "Create and manage data source connections for Data Warehouse transfers"
    },
    {
      "name": "Data Blending",
      "description": "Create and manage Data Blending"
    },
    {
      "name": "Custom Fields",
      "description": "Create and manage Custom Fields"
    },
    {
      "name": "Connectors",
      "description": "Create and manage custom connectors"
    },
    {
      "name": "Connector Secrets",
      "description": "Manage encrypted secrets for connectors"
    },
    {
      "name": "Connector Logs",
      "description": "Access connector execution logs"
    },
    {
      "name": "Connector Logo",
      "description": "Manage connector logos"
    },
    {
      "name": "Connector Schema",
      "description": "Retrieve connector configuration schemas"
    },
    {
      "name": "Datasource",
      "description": "Retrieve datasource configuration details"
    }
  ],
  "externalDocs": {
    "description": "Find out more about Supermetrics Management API",
    "url": "https://docs.supermetrics.com/apidocs/management-api"
  },
  "paths": {
    "/ds/login/link": {
      "post": {
        "summary": "Create login link",
        "description": "Create a new data source login link",
        "operationId": "createLoginLink",
        "tags": [
          "Data Source Login Links"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Login link creation parameters including data source and expiration settings",
          "required": "true",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ds_id"
                ],
                "properties": {
                  "ds_id": {
                    "type": "string",
                    "maxLength": "50",
                    "pattern": "^[A-Za-z0-9_-]+$",
                    "description": "Data source ID"
                  },
                  "expiry_time": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": "50",
                    "description": "Link expiry time as datetime in ISO 8601 format or relative time string (e.g. \"10 hours\"). Defaulting to 24 hours from creation time."
                  },
                  "description": {
                    "type": "string",
                    "maxLength": "1000",
                    "description": "Internal description for the link. Not shown during the authentication attempt."
                  },
                  "require_username": {
                    "type": "string",
                    "maxLength": "255",
                    "description": "Data source username that needs to be used in authentication attempt. Normally used when renewing existing credentials."
                  },
                  "redirect_url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": "500",
                    "description": "Custom URL to redirect to after successful authentication."
                  }
                }
              },
              "example": {
                "ds_id": "GAWA",
                "expiry_time": "2026-03-01T23:59:59Z",
                "description": "Google Analytics login link for marketing team",
                "require_username": "marketing@company.com",
                "redirect_url": "https://company.com/auth/success"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Login link created successfully",
            "headers": {
              "Content-Type": {
                "$ref": "#/components/headers/Content-Type"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Access-Control-Allow-Origin": {
                "$ref": "#/components/headers/Access-Control-Allow-Origin"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginLinkResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/LinkLimitExceeded"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "Content-Type": {
        "description": "HTTP response content type",
        "schema": {
          "type": "string",
          "maxLength": "255",
          "enum": [
            "application/json"
          ],
          "example": "application/json"
        }
      },
      "X-RateLimit-Limit": {
        "description": "Request limit per hour",
        "schema": {
          "type": "integer",
          "format": "int32",
          "minimum": "1",
          "maximum": "10000",
          "example": "5000"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Remaining requests in current window",
        "schema": {
          "type": "integer",
          "format": "int32",
          "minimum": "0",
          "maximum": "10000",
          "example": "4999"
        }
      },
      "Access-Control-Allow-Origin": {
        "description": "CORS header",
        "schema": {
          "type": "string",
          "maxLength": "255",
          "enum": [
            "*"
          ],
          "example": "*"
        }
      },
      "Location": {
        "description": "URL of the created resource",
        "schema": {
          "type": "string",
          "format": "uri",
          "maxLength": "500"
        }
      },
      "WWW-Authenticate": {
        "description": "Bearer token required",
        "schema": {
          "type": "string",
          "maxLength": "255",
          "pattern": "^Bearer.*"
        }
      },
      "Retry-After": {
        "description": "Seconds until rate limit resets",
        "schema": {
          "type": "integer",
          "format": "int32",
          "minimum": "1",
          "maximum": "86400",
          "example": "3600"
        }
      }
    },
    "schemas": {
      "LoginLinkResponse": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "data": {
            "$ref": "#/components/schemas/LoginLink"
          }
        }
      },
      "Meta": {
        "type": "object",
        "description": "Metadata included in every API response.",
        "properties": {
          "request_id": {
            "$ref": "#/components/schemas/RequestId"
          }
        },
        "required": [
          "request_id"
        ],
        "additionalProperties": "false"
      },
      "LoginLink": {
        "type": "object",
        "properties": {
          "link_id": {
            "type": "string",
            "maxLength": "50",
            "description": "Supermetrics login link ID"
          },
          "status_code": {
            "type": "string",
            "maxLength": "50",
            "description": "Current link status",
            "enum": [
              "OPEN",
              "CLOSED",
              "EXPIRED"
            ]
          },
          "description": {
            "type": "string",
            "maxLength": "1000",
            "description": "Internal link description. Not shown during authentication attempt."
          },
          "ds_id": {
            "type": "string",
            "maxLength": "50",
            "description": "Data source ID"
          },
          "ds_name": {
            "type": "string",
            "maxLength": "255",
            "description": "Data source name"
          },
          "require_username": {
            "type": "string",
            "maxLength": "255",
            "description": "Data source username that must be used in authentication attempt"
          },
          "redirect_url": {
            "type": "string",
            "maxLength": "500",
            "description": "Custom URL to redirect to after successful authentication, if any"
          },
          "redirect_verifier": {
            "type": "string",
            "maxLength": "255",
            "description": "Internal verifier string that is passed to redirect_url"
          },
          "user_id": {
            "type": "string",
            "maxLength": "50",
            "description": "Supermetrics user ID of the user who will be marked as the primary owner of the login credentials"
          },
          "user_email": {
            "type": "string",
            "maxLength": "255",
            "description": "Supermetrics user email"
          },
          "login_url": {
            "type": "string",
            "maxLength": "500",
            "description": "Full URL to initiate an authentication attempt. Can be accessed multiple times while link is open."
          },
          "created_time": {
            "type": "string",
            "format": "date-time",
            "maxLength": "50",
            "description": "ISO 8601 datetime for when login link was created"
          },
          "expiry_time": {
            "type": "string",
            "format": "date-time",
            "maxLength": "50",
            "description": "ISO 8601 datetime for when login link will expire"
          },
          "login_id": {
            "type": "string",
            "nullable": "true",
            "maxLength": "50",
            "description": "Supermetrics login ID for a successful authentication"
          },
          "login_time": {
            "type": "string",
            "nullable": "true",
            "format": "date-time",
            "maxLength": "50",
            "description": "ISO 8601 datetime for when authentication occurred"
          },
          "login_username": {
            "type": "string",
            "nullable": "true",
            "maxLength": "255",
            "description": "Username used to authenticate to data source"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Standard envelope returned by all error (4xx/5xx) responses.",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        },
        "required": [
          "meta",
          "error"
        ],
        "additionalProperties": "false"
      },
      "RequestId": {
        "type": "string",
        "description": "Unique identifier for the request, for tracking and debugging.",
        "pattern": "^[A-Za-z0-9_-]+$",
        "minLength": "8",
        "maxLength": "64",
        "example": "BXaEFVtjc7TXaJxgZhmFgSUD9edqq_CN",
        "x-faker": {
          "random.alphaNumeric": "30"
        }
      },
      "Error": {
        "type": "object",
        "description": "Machine- and human-readable detail for a failed request.",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": "100",
            "description": "Stable, screaming-snake-case identifier for the error condition. Clients should branch on this, not on `message`. Common values include BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, CONFLICT_ERROR, PERMISSION_ERROR, UNPROCESSABLE_ENTITY, UNPROCESSABLE_CONTENT, TOO_MANY_REQUESTS, INTERNAL_SERVER_ERROR, DUPLICATION_FAILED, SERVICE_UNAVAILABLE; domains may define additional codes.",
            "example": "BAD_REQUEST"
          },
          "message": {
            "type": "string",
            "maxLength": "255",
            "pattern": "^.+$",
            "description": "Short, human-readable summary of the error.",
            "example": "The request was invalid."
          },
          "description": {
            "type": "string",
            "maxLength": "2048",
            "description": "Optional longer explanation specific to this occurrence.",
            "example": "The field 'display_name' must not be empty."
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": "false"
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Unauthorized",
        "headers": {
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWW-Authenticate"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "meta": {
                "request_id": "BXaEFVtjc7TXaJxgZhmFgSUD9edqq_CN"
              },
              "error": {
                "code": "UNAUTHORIZED",
                "message": "Authentication is required."
              }
            }
          }
        }
      },
      "LinkLimitExceeded": {
        "description": "Link Limit Exceeded",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "maxLength": "100",
                  "enum": [
                    "LINK_LIMIT_EXCEEDED"
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": "255"
                }
              }
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Unprocessable Entity - validation failed for the request parameters",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "meta": {
                "request_id": "BXaEFVtjc7TXaJxgZhmFgSUD9edqq_CN"
              },
              "error": {
                "code": "UNPROCESSABLE_ENTITY",
                "message": "Validation failed for the request parameters."
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too Many Requests",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "meta": {
                "request_id": "BXaEFVtjc7TXaJxgZhmFgSUD9edqq_CN"
              },
              "error": {
                "code": "TOO_MANY_REQUESTS",
                "message": "Rate limit exceeded. Retry later."
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error",
        "headers": {
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "meta": {
                "request_id": "BXaEFVtjc7TXaJxgZhmFgSUD9edqq_CN"
              },
              "error": {
                "code": "INTERNAL_SERVER_ERROR",
                "message": "An unexpected error occurred."
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "otok",
        "description": "Bearer token authentication. Include the token in the Authorization header:\n`Authorization: Bearer <your-token>`\n"
      }
    }
  }
}
````

