Skip to content

Update Form PUT

Replace a form's fields, design and settings. Every field is applied, so send the whole form, not a patch.

Endpoint

PUT https://api.pocketalert.app/v1/forms/{tid}

Authentication

Required

Include one of these headers in your request:

  • Token: <your-api-key> — Get it from API Keys
  • Authorization: Bearer <jwt-token> — From Login

Request

Path Parameters

ParameterTypeRequiredDescription
tidstringForm identifier

Body Parameters

Same as Create Form. Anything you leave out is reset to its default: omitting allowed_origins clears the list, omitting application_tid detaches the application.

Send the current state

The editor loads the form, changes what it needs and sends the result back. A client that sends only the changed keys will silently wipe the rest.

Example Request

bash
curl -X PUT "https://api.pocketalert.app/v1/forms/vml19aihrga216gt8apc5e3m9" \
  -H "Token: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Contact form",
    "is_active": false,
    "max_responses": 100,
    "allowed_origins": ["example.com", "*.shop.example.com"],
    "fields": [
      { "id": "name", "type": "text", "label": "Name", "required": true },
      { "id": "email", "type": "email", "label": "Email", "required": true }
    ],
    "settings": { "title": "Get in touch" }
  }'
javascript
const tid = 'vml19aihrga216gt8apc5e3m9';

// Load the form, change one thing, send it all back.
const [form] = await fetch('https://api.pocketalert.app/v1/forms', {
  headers: { 'Token': 'your-api-key' }
}).then((r) => r.json()).then((forms) => forms.filter((f) => f.tid === tid));

await fetch(`https://api.pocketalert.app/v1/forms/${tid}`, {
  method: 'PUT',
  headers: {
    'Token': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ ...form, is_active: false })
});
python
import requests

tid = 'vml19aihrga216gt8apc5e3m9'
headers = {'Token': 'your-api-key'}

forms = requests.get('https://api.pocketalert.app/v1/forms', headers=headers).json()
form = next(f for f in forms if f['tid'] == tid)

requests.put(
    f'https://api.pocketalert.app/v1/forms/{tid}',
    headers=headers,
    json={**form, 'is_active': False}
)

Response

Success Response

200 OK

The updated form, in the same shape as Create Form.

Error Responses

StatusDescription
400Validation error — the error field says what is wrong
401Unauthorized — Invalid or missing token
404Form not found, or it belongs to another account
500Failed to update form

Pocket Alert Documentation