> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/docs/developers/api-documentation/service/add-new-service-order-secret.md).

# Add new service-order secret

Put a secret on a service order, such as a device passcode. The value is stored encrypted and is never returned in a response — read it through the secrets reveal endpoint. Supply secretUid to make the call idempotent: a repeat with the same secretUid on the same service order returns the secret already created and writes nothing, while a secretUid already used on another service order is refused with a 400, and a malformed uid stays refused. Set serviceFormFieldUid to capture the secret for a SECRET field on the service order's intake form; a required SECRET field on that form is satisfied by a secret carrying its serviceFormFieldUid, and the label then defaults to the label of the field. A secret for a SECRET placement that is not visible, given the values on the service order, is rejected — and when an update's answers later close the branch, the secrets created for its SECRET placements are deleted in the same write. A secret without a serviceFormFieldUid is not tied to the form and must carry a label of its own. A required SECRET placement is demanded when the service order is created and never afterwards: a secret deleted on its own, or with the finished case, is not asked for again. The secrets are open at the store the service order was taken in at as well as at the store that owns it — with a NOTE on the timeline, the only writes that are, because the counter a unit was handed in at is the one the customer comes back to with a passcode. At any other store of the tenant they are refused with a 403, the list included: a reveal is not a view of the case.

Required permissions: SERVICE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Service","description":"Service"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"ServiceOrderSecretResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceOrderSecretResponseSchema"}}}}},"schemas":{"ServiceOrderSecretResponseSchema":{"title":"ServiceOrderSecretResponseSchema","description":"An encrypted secret kept on a service order, such as a device passcode. A service order can hold any number of secrets.\nThe value is never returned here: a secret is listed by its label alone and can only be read through the secrets reveal endpoint, which writes a SECRET_VIEWED event on the service order.\nA secret is never edited. It is created, revealed and deleted, and nothing else — a value that has to change is a new secret and the old one deleted, which is why the record carries when it was created and by whom and nothing about a later change.\nSecrets are never included in search results, webhooks or exports. A secret can be deleted on its own as soon as it is no longer needed, and every secret still on the service order is deleted in the same transaction as the service order reaching a terminal state. Reopening the service order afterwards does not bring them back.","type":"object","required":["secretUid","serviceOrderUid","label","serviceFormFieldUid","createdAt","createdBy"],"properties":{"secretUid":{"$ref":"#/components/schemas/UID"},"serviceOrderUid":{"$ref":"#/components/schemas/UID"},"label":{"type":"string","description":"What the secret is, so it can be shown in a list without revealing the value. Snapshotted when the secret is created — editing the label of the form field afterwards does not change it, and a platform field's label snapshots in the language the capturing user read it in."},"serviceFormFieldUid":{"description":"The SECRET field on the intake form this secret was captured for. An empty string on a secret that was added on its own, without a form field.","type":"string","pattern":"^[A-Za-z0-9-_]*"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ServiceOrderSecretCreateRequestSchema":{"title":"ServiceOrderSecretCreateRequestSchema","description":"A new secret on a service order. The value is stored encrypted and is write-only: it is never returned in any response, and can only be read through the secrets reveal endpoint. Supply secretUid to make the call idempotent: a repeat with the same secretUid on the same service order returns the secret already created and writes nothing, while a secretUid already used on another service order is refused with a 400, and a malformed uid stays refused.\nSet serviceFormFieldUid to capture the secret for a SECRET field on the service order's intake form — a required SECRET field on that form is satisfied by a secret carrying its serviceFormFieldUid. The label may then be left out and defaults to the label of that field; a secret without a serviceFormFieldUid must carry a label of its own.\nA secret can be deleted on its own as soon as it is no longer needed, and every secret still on the service order is deleted when it reaches a terminal state. A required SECRET field is demanded when the service order is created and never on an update: a secret deleted on its own, or with the finished case, is not asked for again.","type":"object","required":["value"],"properties":{"secretUid":{"$ref":"#/components/schemas/UID"},"label":{"type":"string","description":"What the secret is, so it can be shown in a list without revealing the value. Defaults to the label of the form field when serviceFormFieldUid is given; required when it is not."},"value":{"type":"string","description":"The secret value. Stored encrypted, never returned in a response, and readable only through the secrets reveal endpoint."},"serviceFormFieldUid":{"description":"The SECRET field on the service order's intake form this secret is captured for. Leave it out, or send an empty string, for a secret that is not tied to a form field. The field must be of type SECRET and must be placed on the service order's intake form.","type":"string","pattern":"^[A-Za-z0-9-_]*"}}}},"requestBodies":{"ServiceOrderSecretCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceOrderSecretCreateRequestSchema"}}}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/serviceorders/{serviceOrderUid}/secrets":{"post":{"summary":"Add new service-order secret","operationId":"post-serviceorders-secrets","description":"Put a secret on a service order, such as a device passcode. The value is stored encrypted and is never returned in a response — read it through the secrets reveal endpoint. Supply secretUid to make the call idempotent: a repeat with the same secretUid on the same service order returns the secret already created and writes nothing, while a secretUid already used on another service order is refused with a 400, and a malformed uid stays refused.\nSet serviceFormFieldUid to capture the secret for a SECRET field on the service order's intake form; a required SECRET field on that form is satisfied by a secret carrying its serviceFormFieldUid, and the label then defaults to the label of the field. A secret for a SECRET placement that is not visible, given the values on the service order, is rejected — and when an update's answers later close the branch, the secrets created for its SECRET placements are deleted in the same write. A secret without a serviceFormFieldUid is not tied to the form and must carry a label of its own.\nA required SECRET placement is demanded when the service order is created and never afterwards: a secret deleted on its own, or with the finished case, is not asked for again.\nThe secrets are open at the store the service order was taken in at as well as at the store that owns it — with a NOTE on the timeline, the only writes that are, because the counter a unit was handed in at is the one the customer comes back to with a passcode. At any other store of the tenant they are refused with a 403, the list included: a reveal is not a view of the case.\n\nRequired permissions: SERVICE_ORDER","responses":{"201":{"$ref":"#/components/responses/ServiceOrderSecretResponse"}},"requestBody":{"$ref":"#/components/requestBodies/ServiceOrderSecretCreateRequest"},"tags":["Service"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flowretail.com/docs/developers/api-documentation/service/add-new-service-order-secret.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
