Python scripts for managing domains via the Spaceship.com API. Automate domain transfers, DNS management, and more.
- ๐ Unlocks domain transfer locks
- ๐ Retrieves authorization/EPP codes automatically
- ๐พ Saves all results to CSV
- โ Supports batch processing of hundreds of domains
- ๐๏ธ Removes all A records from domains
- ๐ Processes domains from CSV
- ๐ธ Dry-run mode to preview changes
- โก Built-in rate limiting
-
Python 3.x
-
Spaceship API Credentials
- Go to: https://www.spaceship.com/application/api-manager/
- Click "New API key"
- Enable required permissions:
domains:read- Read domain informationdomains:transfer- Unlock domains and get auth codesdnsrecords:read- Read DNS recordsdnsrecords:write- Modify/delete DNS records
- Save your API Key and API Secret
-
Python Dependencies
pip install requests
git clone https://github.com/yourusername/spaceship-domain-tools.git
cd spaceship-domain-toolspip install -r requirements.txtCreate a .env file in the project directory:
cp .env.example .envEdit .env and add your credentials:
SPACESHIP_API_KEY=your_api_key_here
SPACESHIP_API_SECRET=your_api_secret_here.env to git! It's already in .gitignore.
# Dry-run first (recommended)
python3 unlock_domain_transfers.py --csv domains.csv --dry-run
# Run for real
python3 unlock_domain_transfers.py --csv domains.csv --yes# With confirmation prompt
python3 unlock_domain_transfers.py --domain example.com
# Skip confirmation
python3 unlock_domain_transfers.py --domain example.com --yesThe script accepts two formats:
Format 1: Plain text (one domain per line)
example.com
test.com
mysite.com
Format 2: CSV with headers
domain,platform
example.com,Spaceship
test.com,Spaceship
Results are saved to unlock_results.csv:
| domain | unlock_success | unlock_message | is_locked | auth_code | auth_code_expires | timestamp |
|---|---|---|---|---|---|---|
| example.com | True | Unlocked | False | ABC123xyz@#$ | 2100-01-01T00:00:00Z | 2025-10-23T10:30:45 |
The auth_code column contains the codes you need for transferring domains!
# Dry-run first (recommended)
python3 delete_spaceship_a_records.py --csv domains.csv --dry-run
# Run for real
python3 delete_spaceship_a_records.py --csv domains.csvThe script will:
- Load domains from CSV (filters for
platform=Spaceshipby default) - Fetch DNS records for each domain
- Identify A records
- Delete them (with confirmation)
Required (one of):
--csv FILE Path to CSV file or plain text file with domains
--domain DOMAIN Single domain name
Optional:
--dry-run Preview changes without making them
--yes, -y Skip confirmation prompts
--platform NAME Filter CSV by platform (default: None)
--output FILE Output CSV path (default: unlock_results.csv)
--lock Lock domains instead of unlocking
--api-key KEY API key (or use .env)
--api-secret SEC API secret (or use .env)
Optional:
--csv FILE Path to CSV file (default: domain_resolution_results.csv)
--dry-run Preview what would be deleted
--api-key KEY API key (or use .env)
--api-secret SEC API secret (or use .env)
- Never commit
.envfiles - Already in.gitignore - Keep auth codes secure - The output CSV contains sensitive data
- Use dry-run first - Always preview changes before running
- Limit API permissions - Only enable what you need
- Rotate keys regularly - Generate new API keys periodically
# Step 1: Create a list of domains
cat > my_domains.txt <<EOF
example.com
test.com
mysite.com
EOF
# Step 2: Unlock and get auth codes (dry-run first)
python3 unlock_domain_transfers.py --csv my_domains.txt --dry-run
# Step 3: Run for real
python3 unlock_domain_transfers.py --csv my_domains.txt --yes
# Step 4: Open the results to get auth codes
open unlock_results.csv# Preview which domains have A records
python3 delete_spaceship_a_records.py --csv domains.csv --dry-run
# Delete them
python3 delete_spaceship_a_records.py --csv domains.csv# Quick unlock for one domain
python3 unlock_domain_transfers.py --domain example.com --yes
# View the auth code
cat unlock_results.csv | grep example.com- Your API key doesn't have the required permission
- Regenerate the key with correct scopes at the API manager
- Domain is not in your Spaceship account
- Check spelling or verify ownership
- Wait a few minutes before retrying
- Scripts include rate limiting (1.5s per domain)
- You're running in the background without
--yesflag - Add
--yesflag or run in foreground
Spaceship API rate limits:
- Transfer operations: 5 requests per domain within 300 seconds
- DNS operations: Standard rate limits apply
Scripts are configured conservatively:
- Unlock script: 1.5 seconds per domain (2 API calls each)
- Delete script: 0.5 seconds between requests
Found a bug or want to contribute? Feel free to:
- Open an issue
- Submit a pull request
- Share feedback
MIT License - feel free to use and modify as needed.
These scripts interact with live domain data. Always:
- โ Use dry-run mode first
- โ Keep backups of important DNS configurations
- โ Test with a single domain before batch processing
- โ Understand what each script does before running
For API-related issues, contact Spaceship support at: support@spaceship.com
Made with โค๏ธ for domain portfolio management