← Back to Getting started with API v0.1
If you are familiar with our
/enedis/v2 API, see this document as a migration guideWhy v0.1 ?
Introducing new DSOs like GRDF is breaking backwards compatibility. Path
/enedis/v2/… is replaced by api.switchgrid.tech/v0_1/…Each version of the API will have its own specification, and guide.
Consents disappear. Other concepts like Ask and Order stay, but Ask are quite heavily modified (lifecycle, properties and creation arguments)Changes
Old asks have
electricityContracts.New asks have
contracts.{ "contracts": [ ... ], "consentDuration": "2 years" }
Ask with new contracts field⚠️ DOCUSEAL is no longer supported as a consentCollectionMedium
New Asks support contracts from different DSOs than Enedis. We are adapting the web form to support these, but not the PDF-based Docuseal one.
contracts format changes
- You can still reference
GET /search_contractresults by contract uuid.
- The format for other contracts is now as follows
- explicit tags
holder._tag: NaturalPerson | LegalEntityand_energyType: gas | electricity - currently only French contracts are supported, thus the address format is french (with French property names)
{ "_energyType": "gas", "deliveryPointId": "2142764108****", "holder": { "_tag": "NaturalPerson", "fullName": "Jean Dupont" }, "address": { "rueEtNumero": "8 rue du Moulin", "codePostal": "02500", "commune": "Buire" } }
FrenchGasContract{ "_energyType": "electricity", "deliveryPointId": "2142764108****", "holder": { "_tag": "LegalEntity", "name": "SCEA Dupont", "otherNames": ["La ferme de Jean"] }, "address": { "rueEtNumero": "7 rue des Frères", "codePostal": "67000", "commune": "Strasbourg" } }
FrenchElectricityContractContracts without validation
- Enedis offers the possiblity of checking against their systems if a contract exists. Other DSOs do not necessarily offer that (like GRDF in France). So we now allow an Ask to be signed even though it’s possible that there is a mistake in the contract (wrong holder name, wrong delivery point id, etc.), as we have no way to check that for GRDF.
prm/pdm/pce are now called deliveryPointId, no matter what type of energy we are talking about
It refers to the internal DSO id for a “Point de Livraison” in France, and possibly in other countries too. Caution, it’s not the same as the meter’s serial number in most cases.
Changes in Ask lifecycle
Possible status values of asks are now the following :
CREATED
-> will directly go toPENDING_ADDRESS_CHECKPENDING_USER_ACTIONorNOT_VALID
->ADDRESS_CHECK_FAILEDNOT_VALID
NOT_VALIDnew !
PREPARING_CONSENT_COLLECTION
PENDING_USER_ACTION
ACCEPTED
NOT_VALIDis new, and can reflect a couple of problems.
- For transitions
CREATED → INVALIDandCREATED → PENDING_USER_ACTION, webhooks will be triggered.
- On
POST /askWe’ll wait max 3 seconds for one of the above transitions to happen. If they don’t (e.g. when there are many contracts to check), the response will still havestatus: CREATED. Either poll or use the state transition webhooks to tell your users the Ask is ready.
- The Ask’s
consentCollectionUrlwill be available immediately on statusCREATED(and will behttps://app.switchgrid.tech/c/{askId}). If ask is not ready to be signed yet, this will reflect in a message and an impossibility to submit the form.
Backwards compatibililty with previous API /enedis/v2
GET /ask response changes
Fields that are removed :
__experimentalAddressChecksResults
addressCheckResults⇒ this is now in thecontractsnew field.
consentIds⇒Consentobject altogether disappears in favor of revoking anAskentirely, orAskindividual contracts.
Test deliveryPointIds
Like Stripe does it, some special
deliveryPointIds can be used to test our API.There are test
deliveryPointIds for every Dso. If these are specified, no real request to the corresponding Dsos will be made. Instead, deterministic behaviours will happen.Dso | deliveryPointId | type of meter / point / contract | behaviour |
GRDF | 00000000000001 | Residential | Successful flow, with email confirmation sent by Switchgrid.
Data is random, but representative. |
GRDF | 00000000000002 | ||
GRDF | GI0000001 | ㅤ |