Skip to main content

Microsoft Designer API

A Python library for generating images using Microsoft Designer's API.

Installation

pip install microsoftdesigner

Configuration

Create a .env file in your project root with:

USER_ID=your_user_id_here
AUTH_TOKEN=your_auth_token_here

Command Line Usage

python -m microsoftdesigner --help

options:
  -h, --help            show this help message and exit
  --user_id USER_ID     User ID (or set MSDESIGNER_USER_ID env var)
  --auth_token AUTH_TOKEN
                        Authentication token (or set MSDESIGNER_AUTH_TOKEN env var)
  --prompt PROMPT       Image generation prompt
  --save_path SAVE_PATH
                        Path to save generated images (default: images)
  --resolution {1024x1024,1024x1792,1792x1024}
                        Image resolution (default: 1024x1024)
  --boost_count BOOST_COUNT
                        Boost count for generation quality (default: 1)
  --seed SEED          Random seed for reproducible results (optional)

Python Usage

Basic example:

from microsoftdesigner.gen_images import create_img
from dotenv import load_dotenv
import os

load_dotenv()  # Load environment variables from .env file

# Get credentials from environment
user_id = os.getenv("USER_ID") 
auth_token = os.getenv("AUTH_TOKEN")

# Generate images
image_paths = create_img(
    user_id=user_id,
    auth_token=auth_token,
    prompt="a beautiful sunset over mountains",
    save_path="images",      # Optional: defaults to 'images'
    resolution="1024x1024",  # Optional: 1024x1024, 1024x1792, 1792x1024
    boost_count=1,          # Optional: enhance generation quality (default: 1)
    seed=42                 # Optional: set for reproducible results
)

# Example output: list of paths like
# ['images/1024x1024/123e4567-e89b-12d3-a456-426614174000.jpg',
#  'images/1024x1024/987fcdeb-51d3-12d3-a456-426614174000.jpg', ...]
print(f"Generated images saved to: {image_paths}")

Getting Started

  1. Create/login to your Microsoft Designer account
  2. Open browser developer tools (F12) and go to Network tab
  3. Generate an image using any prompt in Microsoft Designer
  4. In the Network tab, find the POST request to /DallE.ashx
  5. From the request headers, copy:
    • UserId header value → set as USER_ID
    • Authorization header value → set as AUTH_TOKEN
  6. Save these values in your .env file or pass them directly to the API

Important Notes

  • Authentication: Auth tokens expire after 24 hours - you'll need to refresh them
  • Resolutions: Only use supported resolutions:
    • Square: 1024x1024
    • Portrait: 1024x1792
    • Widescreen: 1792x1024
  • File Organization: Generated images are automatically saved in resolution-specific subfolders:
    images/
    ├── 1024x1024/
    ├── 1024x1792/
    └── 1792x1024/
    
  • Error Handling: The API will return an empty list if you've run out of credits (403 error)

Release files for microsoftdesigner 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microsoftdesigner 0.0.13
File Size Uploaded
microsoftdesigner-0.0.13.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for microsoftdesigner 0.0.13
File Interpreter ABI Platform
microsoftdesigner-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 37.6 kB

Release files / microsoftdesigner-0.0.13.tar.gz

Download URL microsoftdesigner-0.0.13.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
11ba6a8db281bd30e8947da23537122680386ad9c743e8ed5c3cf00d686acad0
BLAKE2b-256 checksum
How to use checksums
e3d876b9501b78d9541382212c9d048306852c91d619c7a2cf58a8b893b35b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.10.12 Linux/6.8.0-1018-oracle

Release files / microsoftdesigner-0.0.13-py3-none-any.whl

Download URL microsoftdesigner-0.0.13-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a1543e8eb46bfe42b6ea457528e7fcda61381c42c45734af627dbaa27d74af3
BLAKE2b-256 checksum
How to use checksums
410a34cb4df39d0b9d1d3cadb44583ea565286b8d799e0a66271b0bcd937852e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.10.12 Linux/6.8.0-1018-oracle

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

1 release file

0.0.7

2 release files

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page