Create a code
Authentication
AuthorizationBearer
API session token from POST /v1/admin/session (8 hours). Sign-in itself is Google Workspace; see research R2.
Headers
Idempotency-Key
One key per user attempt; retries reuse it and get the original result.
Request
This endpoint expects an object.
status
Allowed values:
discounts
officeIds
code
Set on create, fixed afterwards. Blank on create = generated. Unique across offices, not case-sensitive.
planIds
redemptionLimit
expiresOn
Last valid day, office local time.
campaign
version
Version you last read. Omit on create; required on update. A stale value returns 409 version_conflict.
Response
Created
status
Allowed values:
discounts
officeIds
id
Server-generated.
code
Set on create, fixed afterwards. Blank on create = generated. Unique across offices, not case-sensitive.
planIds
redemptionLimit
redemptionCount
expiresOn
Last valid day, office local time.
campaign
lockedFields
After the first redemption, everything except expiresOn, officeIds, planIds and status.
version
Version you last read. Omit on create; required on update. A stale value returns 409 version_conflict.
Errors
401
Unauthorized Error
403
Forbidden Error
409
Conflict Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error