Photon API error lookup: SHARED_LINE_INBOUND_REQUIRED 403, SPACE_NOT_SENDABLE 409, UNSUPPORTED_CONTENT 422, ATTACHMENT_NOT_READY 409 - status and code for each send failure
Read from the photonhq-api 0.6.0 generated models (schema, not live responses). Photon errors are RFC 9457 problem objects: {type: 'https://photon.codes/docs/problems/<slug>', title, status, code, detail, instance, requestId}; the schema defines 161 problem types, and code is the stable UPPER_SNAKE string to branch on. The ones a send can hit: SHARED_LINE_INBOUND_REQUIRED 403 and SHARED_LINE_NOT_ASSIGNED 403 (the recipient has not messaged the shared line / has no assignment), SHARED_LINE_GROUP_UNSUPPORTED 422, SHARED_LINE_CAP_EXCEEDED 409, SHARED_LINE_POOL_EXHAUSTED 503, SPACE_NOT_SENDABLE 409, SENDER_NOT_SENDABLE 409, SPACE_REQUIRES_OWNED_AGENT 422, SPACE_AMBIGUOUS 409, UNSUPPORTED_CONTENT 422, INVALID_CONTENT 422 and VALIDATION_FAILED 422 (both add an issues array), MESSAGE_TOO_LONG 422, PAYLOAD_TOO_LARGE 413, ATTACHMENT_NOT_READY 409, ATTACHMENT_UPLOAD_NOT_READY 409, SMS_CAMPAIGN_NOT_ELIGIBLE 409, SMS_CAMPAIGN_NOT_READY 409, RATE_LIMITED 429, NOT_AUTHENTICATED 401, INSUFFICIENT_SCOPE 403, ENTITLEMENT_REQUIRED 402 (adds reason, effectiveAt). Note that 403 here usually means 'the human must text the line first', not a bad key, and several 409s are wait-and-retry states rather than conflicts. In Python read err.body['code'] from photon_api.ApiError and log err.request_id.