> For the complete documentation index, see [llms.txt](https://help.multisig.ledger.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.multisig.ledger.com/reference/delegates.md).

# Delegates

## GET /api/v2/delegates/

> Returns a list with all the delegates

```json
{"openapi":"3.1.0","info":{"title":"Safe Transaction Service","version":"5.33.1"},"security":[{"cookieAuth":[]},{"tokenAuth":[]},{}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"sessionid"},"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"PaginatedSafeDelegateResponseList":{"type":"object","required":["count","results"],"properties":{"count":{"type":"integer"},"next":{"type":"string","nullable":true,"format":"uri"},"previous":{"type":"string","nullable":true,"format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/SafeDelegateResponse"}}}},"SafeDelegateResponse":{"type":"object","properties":{"safe":{"type":"string"},"delegate":{"type":"string"},"delegator":{"type":"string"},"label":{"type":"string","maxLength":50},"expiryDate":{"type":"string","format":"date-time"}},"required":["delegate","delegator","expiryDate","label","safe"]}}},"paths":{"/api/v2/delegates/":{"get":{"operationId":"delegates_list_2","description":"Returns a list with all the delegates","parameters":[{"in":"query","name":"safe","schema":{"type":["string","null"]}},{"in":"query","name":"delegate","schema":{"type":"string"}},{"in":"query","name":"delegator","schema":{"type":"string"}},{"in":"query","name":"label","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Number of results to return per page.","schema":{"type":"integer"}},{"name":"offset","required":false,"in":"query","description":"The initial index from which to return the results.","schema":{"type":"integer"}}],"tags":["delegates"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedSafeDelegateResponseList"}}},"description":""},"400":{"description":"Invalid data"}}}}}}
```

## POST /api/v2/delegates/

> Adds a new Safe delegate with a custom label. Calls with same delegate but different label or\
> signer will update the label or delegator if a different one is provided.\
> To generate the signature, the following EIP712 data hash needs to be signed:\
> \
> \`\`\`python\
> &#x20;{\
> &#x20;   "types": {\
> &#x20;       "EIP712Domain": \[\
> &#x20;           {"name": "name", "type": "string"},\
> &#x20;           {"name": "version", "type": "string"},\
> &#x20;           {"name": "chainId", "type": "uint256"},\
> &#x20;       ],\
> &#x20;       "Delegate": \[\
> &#x20;           {"name": "delegateAddress", "type": "address"},\
> &#x20;           {"name": "totp", "type": "uint256"},\
> &#x20;       ],\
> &#x20;   },\
> &#x20;   "primaryType": "Delegate",\
> &#x20;   "domain": {\
> &#x20;       "name": "Safe Transaction Service",\
> &#x20;       "version": "1.0",\
> &#x20;       "chainId": chain\_id,\
> &#x20;   },\
> &#x20;   "message": {\
> &#x20;       "delegateAddress": delegate\_address,\
> &#x20;       "totp": totp,\
> &#x20;   },\
> }\
> \`\`\`\
> \
> For the signature we use \`TOTP\` with \`T0=0\` and \`Tx=3600\`. \`TOTP\` is calculated by taking the\
> Unix UTC epoch time (no milliseconds) and dividing by 3600 (natural division, no decimals).

````json
{"openapi":"3.1.0","info":{"title":"Safe Transaction Service","version":"5.33.1"},"security":[{"cookieAuth":[]},{"tokenAuth":[]},{}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"sessionid"},"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"DelegateSerializerV2":{"type":"object","description":"Mixin to validate delegate operations data","properties":{"safe":{"type":["string","null"]},"delegate":{"type":"string"},"delegator":{"type":"string"},"signature":{"type":"string"},"label":{"type":"string","maxLength":50},"expiryDate":{"type":["string","null"],"format":"date-time"}},"required":["delegate","delegator","label","signature"]}}},"paths":{"/api/v2/delegates/":{"post":{"operationId":"delegates_create_2","description":"Adds a new Safe delegate with a custom label. Calls with same delegate but different label or\nsigner will update the label or delegator if a different one is provided.\nTo generate the signature, the following EIP712 data hash needs to be signed:\n\n```python\n {\n    \"types\": {\n        \"EIP712Domain\": [\n            {\"name\": \"name\", \"type\": \"string\"},\n            {\"name\": \"version\", \"type\": \"string\"},\n            {\"name\": \"chainId\", \"type\": \"uint256\"},\n        ],\n        \"Delegate\": [\n            {\"name\": \"delegateAddress\", \"type\": \"address\"},\n            {\"name\": \"totp\", \"type\": \"uint256\"},\n        ],\n    },\n    \"primaryType\": \"Delegate\",\n    \"domain\": {\n        \"name\": \"Safe Transaction Service\",\n        \"version\": \"1.0\",\n        \"chainId\": chain_id,\n    },\n    \"message\": {\n        \"delegateAddress\": delegate_address,\n        \"totp\": totp,\n    },\n}\n```\n\nFor the signature we use `TOTP` with `T0=0` and `Tx=3600`. `TOTP` is calculated by taking the\nUnix UTC epoch time (no milliseconds) and dividing by 3600 (natural division, no decimals).","tags":["delegates"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DelegateSerializerV2"}}},"required":true},"responses":{"202":{"description":"Accepted"},"400":{"description":"Malformed data"}}}}}}
````

## DELETE /api/v2/delegates/{delegate\_address}/

> Removes every delegate/delegator pair found associated with a given delegate address. The\
> signature is built the same way as for adding a delegate, but in this case the signer can be\
> either the \`delegator\` (owner) or the \`delegate\` itself. Check \`POST /delegates/\` to learn more.

```json
{"openapi":"3.1.0","info":{"title":"Safe Transaction Service","version":"5.33.1"},"security":[{"cookieAuth":[]},{"tokenAuth":[]},{}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"sessionid"},"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/api/v2/delegates/{delegate_address}/":{"delete":{"operationId":"delegates_destroy_2","description":"Removes every delegate/delegator pair found associated with a given delegate address. The\nsignature is built the same way as for adding a delegate, but in this case the signer can be\neither the `delegator` (owner) or the `delegate` itself. Check `POST /delegates/` to learn more.","parameters":[{"in":"path","name":"delegate_address","schema":{"type":"string"},"required":true}],"tags":["delegates"],"responses":{"204":{"description":"Deleted"},"400":{"description":"Malformed data"},"404":{"description":"Delegate not found"},"422":{"description":"Invalid Ethereum address/Error processing data"}}}}}}
```
