Migrating Your User Data to Scute
Welcome to our user data migration guide! This document will walk you through the process of moving your user data into Scute's system. We'll cover everything you need to know, from understanding how we store user information to practical examples of using our API.
Understanding User Data in Scute
Before we dive into the technical details, let's understand how Scute organizes user information. Each user in our system has two main components:
Basic User Information
Every user has these fundamental attributes:
- A unique identifier (UUID)
- Contact information (email and/or phone)
- Name
- Account status (active, pending, inactive, or imported)
- Verification timestamps for email and phone
Custom User Attributes
Need to store additional information about your users? We've got you covered! You can add custom fields with various data types:
📝 Available Data Types:
string
- For general text databoolean
- For yes/no flagsinteger
- For whole numbersdate
- For timestamps and calendar datesphone
- For phone numbers with validationemail
- For email addresses with validationtext
- For longer text contenturl
- For web links
Moving Your Users to Scute
The API Endpoint
Here's how you can create new users through our API:
API Request & Response
POST /v1/auth/:app_id/users
Request Body:
{
"identifier": "<email_or_phone>", // Required: User's email or phone
"user_meta": { // Optional: Custom user metadata
"field1": "value1",
"field2": "value2"
}
}
Responses:
200 OK
{
"user": {
"id": "uuid",
"email": "user@example.com",
"phone": "+1234567890",
"meta": { ... }
},
"user_meta_errors": { } // Any errors in metadata validation
}
400 Bad Request
{
"error": "Identifier invalid",
"error_code": "invalid_identifier"
}
Example Usage
CURL Example
Create User with CURL
# Create a new user with email
curl -X POST 'https://api.scute.io/v1/auth/your_app_id/users' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"identifier": "user@example.com",
"user_meta": {
"company": "Acme Inc",
"role": "admin",
"signup_date": "2024-03-20"
}
}'
# Create a user with phone number
curl -X POST 'https://api.scute.io/v1/auth/your_app_id/users' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"identifier": "+14155552671",
"user_meta": {
"location": "San Francisco",
"is_verified": true
}
}'
Shell Script Example
Migration Script
#!/bin/bash
# Configuration
API_KEY="your_api_key_here"
APP_ID="your_app_id"
API_URL="https://api.scute.io/v1/auth/$APP_ID/users"
# Function to create a user
create_user() {
local identifier=$1
local meta=$2
response=$(curl -s -X POST "$API_URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"identifier\": \"$identifier\",
\"user_meta\": $meta
}")
echo "$response"
}
# Example usage
user_meta='{
"company": "Tech Corp",
"department": "Engineering",
"start_date": "2024-03-20"
}'
# Create user with email
create_user "engineer@techcorp.com" "$user_meta"
# Create user with phone
create_user "+14155552671" "$user_meta"
Important Things to Keep in Mind
Data Validation
- Email addresses must match standard format
- Phone numbers should be in international format
- Custom fields must match their declared types
Security Best Practices
- Always use HTTPS for API calls
- Keep your API keys secure
- Handle personal information with care
Tips for a Smooth Migration
- Back Up Your Data: Always keep a backup of your source data before starting
- Start Small: Test with a small batch of users first
- Verify as You Go: Check each batch after migration
- Monitor Progress: Keep track of successful and failed migrations
Need help with your migration? Don't hesitate to reach out to our support team!