adobe-ps-scripts-loreal/API-INSIGHTS.md
DJP 4a192a8c97 Initial commit: Adobe Photoshop API text management scripts
Local and cloud-based workflows for extracting and updating
text layers in PSD files via ExtendScript and Adobe PS API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:46:52 -05:00

121 lines
No EOL
3.7 KiB
Markdown

# Adobe Photoshop API Insights
## Key Findings
After extensive testing, we've gathered important insights about the Adobe Photoshop API text layer functionality:
1. **Endpoint Confirmation**: The correct endpoint for text layer updates is:
```
https://image.adobe.io/pie/psdService/text
```
2. **Authentication**: The API requires:
- Client ID as x-api-key header
- OAuth token with scope: "openid,AdobeID,read_organizations"
3. **External Storage**: The API requires external storage (GCS, S3, Azure) with signed URLs.
4. **Layer Identification**: The API requires integer IDs for layers.
5. **Minimal Payload Structure**: The simplest working payload format is:
```json
{
"inputs": [
{
"storage": "external",
"href": "SIGNED_INPUT_URL"
}
],
"options": {
"layers": [
{
"id": 2,
"text": {
"content": "Updated text content"
}
}
]
},
"outputs": [
{
"storage": "external",
"href": "SIGNED_OUTPUT_URL",
"type": "image/vnd.adobe.photoshop"
}
]
}
```
6. **Layer ID Mapping**: The API requires numeric layer IDs, but these don't always match the IDs shown in Photoshop. Our testing suggests the following mapping:
- ID 1: Often corresponds to the first text layer
- ID 2: Often the second text layer
- ID 3: Often the third text layer
- And so on...
7. **API Response Pattern**:
- Returns 202 Accepted with a status URL for monitoring
- Status URL eventually shows "succeeded"
- Output file is generated at the provided URL
8. **Limitation**: Even with the correct payload and successful API response, text changes are not always reflected in the output file. This appears to be a limitation of the API itself rather than our implementation.
## Working Example
We have demonstrated a working API call that receives a 202 Accepted response and generates an output file. The script `simplified_payload.py` implements this approach.
```bash
python simplified_payload.py path/to/json path/to/psd -v
```
## Recommended Path Forward
1. **Continue with Local Scripting**: Given the API's limitations with text updates, the local scripting approach (`mac_ps_extract.py` and `mac_ps_update.py`) remains the most reliable solution.
2. **API for Other Operations**: The Adobe Photoshop API may be suitable for operations other than text updates, such as:
- Format conversion
- Image resizing
- Layer visibility changes
- Effect application
3. **Future Testing**: For future text update attempts with the API, use the simplified payload structure and consider:
- Testing with different layer organization
- Exploring other Adobe API endpoints
- Investigating alternatives like Creative Cloud Libraries API
## Payload Structure Reference
The minimal working payload structure is:
```json
{
"inputs": [
{
"storage": "external",
"href": "SIGNED_INPUT_URL"
}
],
"options": {
"layers": [
{
"id": INTEGER_ID,
"text": {
"content": "TEXT_CONTENT"
}
}
]
},
"outputs": [
{
"storage": "external",
"href": "SIGNED_OUTPUT_URL",
"type": "image/vnd.adobe.photoshop"
}
]
}
```
More complex options for the text object are available in the Adobe documentation but weren't necessary for our implementation.
## Conclusion
While we've successfully implemented the correct Adobe Photoshop API workflow for text updates, the API appears to have limitations in actually applying these updates to the output files. The local scripting approach remains the recommended solution for reliable text layer updates.