Request Generation
Submit a generation request to the backend
POST
https://api.genrex.com/v1/text2music/generateMusic
Request body
{
"duration":10,
"text":"music"
}
duration integer Required
- The duration of music. The value must be between 5 seconds and 60 seconds.
text string Required
- The prompt text of the generation. The string must be between 1 and 250 characters.
Headers
{
'gx-key': '4nBmZkU2-VdTNrPqL7e9y', // Suppose your-api-secret = 7Xd9PfMlkanB5ZTuj0qQG
'gx-signature': 't=1717574785354,v=c3eaaf9b064283cd3558b1a8e759a0ed5f1d5d805992ce0b02c937f4e2e6cf90',
'Content-Type': 'application/json' ,
}
gx-key string Required
- your-api-key
gx-signature string Required
To generate the
gx-signature
, follow these steps:
- Convert the payload object to a JSON string.
- Concatenate the current timestamp and the JSON string with a dot (.) to form the string to be signed e.g.
${timestamp}.${payload}
- Use the
sha256-HMAC
algorithm andyour-api-secret
to sign the string, generating a hexadecimal string signature.- The
gx-signature
field value should be formatted ast=timestamp,v=signature
.
Content-Type string Required
- Must be set to application/json.
Responses
- response.data
{
id: 'QRY_WRXzIXyidD8x9xIEZZ4GppXh',
processSystem: 'GenrexV1',
source: 'API',
status: 'Processing',
contentType: 'Text',
content: { text: 'music', duration: 30 },
metadata: null,
userId: 'a6f434b6-a475-40b1-81e3-3ce9868945ff',
createdAt: '2024-06-02T16:16:07.386Z',
updatedAt: '2024-06-02T16:16:07.386Z'
}
id string
- The id is used to check if the generation query is complete. Recommend save locally.
processSystem string
- The versioning of AI
source string
- The source of the request
status string
- The status of the generation, which can be either
Processing
,Failed
, orCompleted
.content object
metadata array or null
userId string
createdAt string
- The timestamp when the query was created
updatedAt string
- The timestamp when the status was last updated